コード例 #1
0
 def test_init_tuple(self):
     t = (1, 2, 3, 4)
     pl = InputList(t)
     self.assertEqual(len(pl), len(t),
                      "not the same length as source tuple")
     self.assertEqual(tuple(pl.values()), t,
                      "conversion to tuple not the same as source tuple")
コード例 #2
0
 def test_init_set(self):
     s = {1, 2, 3, 4}
     pl = InputList(s)
     self.assertEqual(len(pl), len(s), "not the same length as source set")
     self.assertEqual(set(pl.values()), s,
                      "conversion to set not the same as source set")
コード例 #3
0
 def test_init_list(self):
     l = [1, 2, 3, 4]
     pl = InputList(l)
     self.assertEqual(len(pl), len(l), "not the same length as source list")
     self.assertEqual(list(pl.values()), l,
                      "conversion to list not the same as source list")
コード例 #4
0
 def test_extend(self):
     pl = InputList()
     pl.extend([1, 2, 3])
     self.assertEqual(list(pl.values()), [1, 2, 3],
                      "extend from list does not set values")