def test_pop_does_nothing_and_returns_the_provided_default_value_when_provided_key_doesnt_exist(self): d = ImageDict() obj1 = cv2.imread(path.join(_this_path, 'data', 'object.png')) default_value = 1 popped_value = d.pop(obj1, default_value) #pop a non-existent key self.assertEqual(popped_value, default_value) self.assertEqual(len(d), 0) #should still be empty
def test_pop_removes_the_provided_key_when_it_exists_and_returns_its_value(self): d = ImageDict() obj1 = cv2.imread(path.join(_this_path, 'data', 'object.png')) value_1 = 1 d[obj1] = value_1 popped_value = d.pop(obj1) self.assertEqual(popped_value, value_1) self.assertEqual(len(d), 0) #should be empty after pop