Example #1
0
 def test_iterating_over_an_ImageDict_provides_a_generator_of_keys_as_image_mask_pairs(self):
     d = ImageDict()
     obj1 = cv2.imread(path.join(_this_path, 'data', 'object.png'))
     mask1 = cv2.imread(path.join(_this_path, 'data', 'object_mask.png'))
     obj2 = cv2.imread(path.join(_this_path, 'data', 'different_object.png'))
     d[obj1, mask1] = 1
     d[obj2] = 2
     keys_specification = [(obj1, mask1), (obj2, None)]
     keys_by_iter = (key for key in d)
     keys_by_iterkeys = d.iterkeys()
     keys_by_keys = d.keys()
     self.assertItemsEqual(list(keys_by_iter), keys_specification)
     self.assertItemsEqual(list(keys_by_iterkeys), keys_specification)
     self.assertItemsEqual(keys_by_keys, keys_specification)