def testRCopyNestedDict(self): d = {"a": {"b": {"c": 1}}} self.assertDictEqual(d, rCopy(d)) def f(value, _keys): return value * 2 expected = {"a": {"b": {"c": 2}}} self.assertDictEqual(expected, rCopy(d, f))
def testRCopyFlatDict(self): d = {"a": 1, "b": 2, "c": 3} self.assertDictEqual(d, rCopy(d)) def f(value, _keys): return value * 2 expected = {"a": 2, "b": 4, "c": 6} self.assertDictEqual(expected, rCopy(d, f))
def testRCopyComplexNestedDict(self): d = {"a": {"b": {"c": [1, 2, 3]}, "d": "Hello", "e": 17}} self.assertDictEqual(d, rCopy(d)) def f(value, _keys): return value * 2 expected = {"a": {"b": {"c": [1, 2, 3, 1, 2, 3]}, "d": "HelloHello", "e": 34}} self.assertDictEqual(expected, rCopy(d, f))
def testRCopyComplexNestedDict(self): d = {"a": {"b": {"c": [1, 2, 3]}, "d": "Hello", "e": 17}} self.assertDictEqual(d, rCopy(d)) def f(value, _keys): return value * 2 expected = { "a": { "b": { "c": [1, 2, 3, 1, 2, 3] }, "d": "HelloHello", "e": 34 } } self.assertDictEqual(expected, rCopy(d, f))
def testRCopyEmpty(self): d = {} self.assertDictEqual(d, rCopy(d)) self.assertDictEqual(d, rCopy(d, lambda x: 2 * x))
def testRCopyEmpty(self): d = {} self.assertDictEqual(d, rCopy(d)) self.assertDictEqual(d, rCopy(d, lambda x: 2* x))