def test_compute_delta_no_delete_change(self): new_dict = {'same_key1': 'same_value', 'same_key2': 'new_value'} old_dict = {'same_key1': 'same_value', 'same_key2': 'old_value'} expected_result = DictDelta({}, {'same_key2': 'new_value'}, {}) result = DeltaComputer.compute_delta_no_delete(new_dict, old_dict) self.assertEqual(result, expected_result)
def test_compute_delta_add(self): new_dict = {'old_key': 'old_value', 'new_key': 'new_value'} old_dict = {'old_key': 'old_value'} expected_result = DictDelta({'new_key': 'new_value'}, {}, {}) result = DeltaComputer.compute_delta(new_dict, old_dict) self.assertEqual(result, expected_result)
def test_compute_delta_no_delete_delete(self): new_dict = {'old_key': 'old_value'} old_dict = {'old_key': 'old_value', 'removed_key': 'removed_value'} expected_result = DictDelta({}, {}, {}) result = DeltaComputer.compute_delta_no_delete(new_dict, old_dict) self.assertEqual(result, expected_result)
def test_compute_delta_empty_empty(self): new_dict = {} old_dict = {} expected_result = DictDelta({}, {}, {}) result = DeltaComputer.compute_delta(new_dict, old_dict) self.assertEqual(result, expected_result)