Exemplo n.º 1
0
 def test_flatten_n(self):
     """tuple with quite a number of string elements"""
     self.assertEqual(
         list(
             y.flatten(("abc", "def", "ghi", "jkl", "mno", "pqr", "stu",
                        "vwx", "yzß"))),
         ["abc", "def", "ghi", "jkl", "mno", "pqr", "stu", "vwx", "yzß"])
Exemplo n.º 2
0
 def test_flatten_nested(self):
     """nested tuple with quite a number of string elements"""
     self.assertEqual(
         list(
             y.flatten(
                 ([], "abc", ["def",
                              "ghi"], ("jkl"), [(["mno"], "pqr"), "stu",
                                                "vwx"], "yzß"))),
         ["abc", "def", "ghi", "jkl", "mno", "pqr", "stu", "vwx", "yzß"])
Exemplo n.º 3
0
 def test_flatten_2a(self):
     """tuple with two string elements"""
     self.assertEqual(list(y.flatten(("abc", "def"))), ["abc", "def"])
Exemplo n.º 4
0
 def test_flatten_2(self):
     """tuple with two non-string elements"""
     self.assertEqual(list(y.flatten((4, 5))), [4, 5])
Exemplo n.º 5
0
 def test_flatten_1a(self):
     """list with single string element"""
     self.assertEqual(list(y.flatten(["abc"])), ["abc"])
Exemplo n.º 6
0
 def test_flatten_1(self):
     """list with single non-string element"""
     self.assertEqual(list(y.flatten([4])), [4])
Exemplo n.º 7
0
 def test_flatten_0a(self):
     """non-list string argument"""
     self.assertEqual(list(y.flatten("abc")), ["abc"])
Exemplo n.º 8
0
 def test_flatten_0(self):
     """non-list non-string argument"""
     self.assertEqual(list(y.flatten(4)), [4])