示例#1
0
 def test_big_list(self):
     big_list = [1, 2, 3, 4, 5]
     result = images2grey.list_split(big_list, 3)
     self.assertEqual(next(result), big_list[0:1])
     self.assertEqual(next(result), big_list[1:2])
     self.assertEqual(next(result), big_list[2:])
     self.assertRaises(StopIteration, lambda: next(result))
示例#2
0
 def test_simple_list(self):
     simple = [1, 2, 3]
     result = images2grey.list_split(simple, len(simple))
     for i in range(len(simple)):
         self.assertEqual(next(result), simple[i:i+1])