예제 #1
0
 def test_init_tuple(self):
     t = (1, 2, 3, 4)
     pl = DataContainer(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 = DataContainer(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 = DataContainer(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 = DataContainer()
     pl.extend([1, 2, 3])
     self.assertEqual(list(pl.values()), [1, 2, 3],
                      "extend from list does not set values")