Beispiel #1
0
 def test_setdefault_with_an_existing_key_returns_the_existing_keys_value(self):
     d = ImageDict()
     obj = cv2.imread(path.join(_this_path, 'data', 'object.png'))
     original_value = 1
     new_value = 2
     d[obj] = original_value
     d.setdefault(obj, new_value)
     self.assertEqual(d._keypackages[0].value, original_value)
Beispiel #2
0
 def test_setdefault_with_a_key_that_doesnt_exist_sets_the_new_item_and_returns_the_new_value(self):
     d = ImageDict()
     obj = cv2.imread(path.join(_this_path, 'data', 'object.png'))
     new_value = 2
     d.setdefault(obj, new_value)
     self.assertEqual(d._keypackages[0].value, new_value)