def test_zip_longest(self): l1 = [1, 2, 3, 4, 5] l2 = ['a', 'b', 'c'] result = [(1, 'a'), (2, 'b'), (3, 'c'), (4, None), (5, None)] self.assertListEqual(funcs.zip_(l1, l2), result)
def test_zip_longest_pad_empty(self): l1 = [1, 2, 3, 4, 5] l2 = ['a', 'b', 'c'] result = [(1, 'a'), (2, 'b'), (3, 'c'), (4, 'foobar'), (5, 'foobar')] self.assertListEqual(funcs.zip_(l1, l2, pad='foobar'), result)
def test_zip_longest_pad_empty(self): l1 = [1, 2, 3, 4, 5] l2 = ["a", "b", "c"] result = [(1, "a"), (2, "b"), (3, "c"), (4, "foobar"), (5, "foobar")] self.assertListEqual(funcs.zip_(l1, l2, pad="foobar"), result)
def test_zip_double(self): l1 = [1, 2, 3, 4, 5] l2 = ['a', 'b', 'c', 'd', 'e'] result = [(1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e')] self.assertListEqual(funcs.zip_(l1, l2), result)
def test_zip_longest(self): l1 = [1, 2, 3, 4, 5] l2 = ["a", "b", "c"] result = [(1, "a"), (2, "b"), (3, "c"), (4, None), (5, None)] self.assertListEqual(funcs.zip_(l1, l2), result)
def test_zip_double(self): l1 = [1, 2, 3, 4, 5] l2 = ["a", "b", "c", "d", "e"] result = [(1, "a"), (2, "b"), (3, "c"), (4, "d"), (5, "e")] self.assertListEqual(funcs.zip_(l1, l2), result)
def test_zip_longest_pad_value(self): l1 = [] l2 = ['a', 'b', 'c'] value = 'z' result = [('z', 'a'), ('z', 'b'), ('z', 'c')] self.assertListEqual(funcs.zip_(l1, l2, pad=value), result)
def test_zip_longest_pad_value(self): l1 = [] l2 = ["a", "b", "c"] value = "z" result = [("z", "a"), ("z", "b"), ("z", "c")] self.assertListEqual(funcs.zip_(l1, l2, pad=value), result)
def test_zip_multiple(self): l1 = [1, 2, 3, 4, 5] l2 = ['a', 'b', 'c', 'd', 'e'] l3 = ['i', 'ii', 'iii', 'iv', 'v'] result = [(1, 'a', 'i'), (2, 'b', 'ii'), (3, 'c', 'iii'), (4, 'd', 'iv'), (5, 'e', 'v')] self.assertListEqual(funcs.zip_(l1, l2, l3), result)
def test_zip_multiple(self): l1 = [1, 2, 3, 4, 5] l2 = ["a", "b", "c", "d", "e"] l3 = ["i", "ii", "iii", "iv", "v"] result = [(1, "a", "i"), (2, "b", "ii"), (3, "c", "iii"), (4, "d", "iv"), (5, "e", "v")] self.assertListEqual(funcs.zip_(l1, l2, l3), result)
def test_zip_single(self): l = [1, 2, 3, 4, 5] self.assertListEqual(funcs.zip_(l), l)
def test_zip_null(self): self.assertListEqual(funcs.zip_(None), [])
def test_zip_empty(self): self.assertListEqual(funcs.zip_(), [])
def test_zip_single(self): test_list = [1, 2, 3, 4, 5] self.assertListEqual(funcs.zip_(test_list), test_list)