def test_merge_dicts_copy(self): d = {'a': 1, 'b': 1} self.assertDictEqual(transformations.merge_dicts(d, copy=True), d) self.assertDictEqual(transformations.merge_dicts(d, d, copy=True), d) self.assertDictEqual(transformations.merge_dicts(d, {'a': 2}, copy=True), {'a': 2, 'b':1}) self.assertDictEqual(d, {'a': 1, 'b': 1})
def test_merge_dicts_no_copy(self): d = {'a': 1, 'b': 1} self.assertDictEqual(transformations.merge_dicts(d, copy=False), d) self.assertDictEqual(transformations.merge_dicts(d, d, copy=False), d) self.assertDictEqual(transformations.merge_dicts(d, {'a': 2}, copy=False), {'a': 2, 'b':1}) self.assertEquals(d['a'], 2)
def test_merge_dicts_basics(self): self.assertDictEqual(transformations.merge_dicts({'a': 1}), {'a': 1}) self.assertDictEqual(transformations.merge_dicts({'a': 1}, {'a': 2}), {'a': 2}) self.assertDictEqual(transformations.merge_dicts( {'a': 1, 'b': 1}, {'a': 2, 'c': 1}), {'a': 2, 'b': 1, 'c': 1})