Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
    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)
Ejemplo n.º 3
0
    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)
Ejemplo n.º 4
0
    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)
Ejemplo n.º 5
0
    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)
Ejemplo n.º 6
0
    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)
Ejemplo n.º 7
0
    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)
Ejemplo n.º 8
0
    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)
Ejemplo n.º 9
0
    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)
Ejemplo n.º 10
0
    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)
Ejemplo n.º 11
0
    def test_zip_single(self):
        l = [1, 2, 3, 4, 5]

        self.assertListEqual(funcs.zip_(l), l)
Ejemplo n.º 12
0
 def test_zip_null(self):
     self.assertListEqual(funcs.zip_(None), [])
Ejemplo n.º 13
0
 def test_zip_empty(self):
     self.assertListEqual(funcs.zip_(), [])
Ejemplo n.º 14
0
    def test_zip_single(self):
        test_list = [1, 2, 3, 4, 5]

        self.assertListEqual(funcs.zip_(test_list), test_list)