def test_lmap(self): func = lambda x, y, z: x + y + z lst = [builtins.range(10), builtins.range(10), builtins.range(10)] results = lmap(func, *lst), expecteds = list(builtins.map(func, *lst)), lengths = 10, self.check_results(results, expecteds, lengths)
def test_map(self): func = lambda x, y, z: x + y + z lst = [builtins.range(10), builtins.range(10), builtins.range(10)] actual1 = map(func, *lst) actual2 = lmap(func, *lst) actual = [actual1, actual2], expected = list(builtins.map(func, *lst)), lengths = 10, self.check_result(actual, expected, lengths)
def test_lrange(self): results = lrange(10), expecteds = list(builtins.range(10)), lengths = 10, results += lrange(1, 10, 2), lengths += 5, expecteds += list(builtins.range(1, 10, 2)), self.check_results(results, expecteds, lengths)
def test_range(self): actual1 = range(10) actual2 = lrange(10) actual = [actual1, actual2], expected = list(builtins.range(10)), lengths = 10, actual1 = range(1, 10, 2) actual2 = lrange(1, 10, 2) actual += [actual1, actual2], lengths += 5, expected += list(builtins.range(1, 10, 2)), self.check_result(actual, expected, lengths)
def test_range(self): actual1 = range(10) actual2 = lrange(10) actual = ([actual1, actual2],) expected = (list(builtins.range(10)),) lengths = (10,) actual1 = range(1, 10, 2) actual2 = lrange(1, 10, 2) actual += ([actual1, actual2],) lengths += (5,) expected += (list(builtins.range(1, 10, 2)),) self.check_result(actual, expected, lengths)
def test_lfilter(self): func = lambda x: x lst = list(builtins.range(10)) results = lfilter(lambda x: x, lst), lengths = 9, expecteds = list(builtins.filter(func, lst)), self.check_results(results, expecteds, lengths)
def test_filter(self): func = lambda x: x lst = list(builtins.range(10)) actual1 = filter(func, lst) actual2 = lfilter(func, lst) actual = [actual1, actual2], lengths = 9, expected = list(builtins.filter(func, lst)), self.check_result(actual, expected, lengths)
def test_zip(self): lst = [builtins.range(10), builtins.range(10), builtins.range(10)] actual = [zip(*lst), lzip(*lst)], expected = list(builtins.zip(*lst)), lengths = 10, self.check_result(actual, expected, lengths)
def test_lzip(self): lst = [builtins.range(10), builtins.range(10), builtins.range(10)] results = lzip(*lst), expecteds = list(builtins.zip(*lst)), lengths = 10, self.check_results(results, expecteds, lengths)