def test_merge_overwrite_traditional(self): ''' Test traditional overwrite, wherein a key in the second dict overwrites a key in the first ''' mdict = copy.deepcopy(self.dict1) mdict['A'] = 'b' ret = dictupdate.merge_overwrite(copy.deepcopy(self.dict1), {'A': 'b'}) self.assertEqual(mdict, ret)
def test_merge_overwrite_traditional(self): """ Test traditional overwrite, wherein a key in the second dict overwrites a key in the first """ mdict = copy.deepcopy(self.dict1) mdict["A"] = "b" ret = dictupdate.merge_overwrite(copy.deepcopy(self.dict1), {"A": "b"}) self.assertEqual(mdict, ret)
def test_merge_aggregate_traditional(self): ''' Test traditional aggregation, where a val from dict2 overwrites one present in dict1 ''' mdict = copy.deepcopy(self.dict1) mdict['A'] = 'b' ret = dictupdate.merge_overwrite(copy.deepcopy(self.dict1), {'A': 'b'}) self.assertEqual(mdict, ret)
def test_merge_aggregate_traditional(self): """ Test traditional aggregation, where a val from dict2 overwrites one present in dict1 """ mdict = copy.deepcopy(self.dict1) mdict["A"] = "b" ret = dictupdate.merge_overwrite(copy.deepcopy(self.dict1), {"A": "b"}) self.assertEqual(mdict, ret)
def test_merge_overwrite_missing_source_key(self): ''' Test case wherein the overwrite strategy is used but a key in the second dict is not present in the first ''' mdict = copy.deepcopy(self.dict1) mdict['D'] = 'new' ret = dictupdate.merge_overwrite(copy.deepcopy(self.dict1), {'D': 'new'}) self.assertEqual(mdict, ret)
def test_merge_overwrite_missing_source_key(self): """ Test case wherein the overwrite strategy is used but a key in the second dict is not present in the first """ mdict = copy.deepcopy(self.dict1) mdict["D"] = "new" ret = dictupdate.merge_overwrite(copy.deepcopy(self.dict1), {"D": "new"}) self.assertEqual(mdict, ret)