def test_nested_update(self): d = NestedDict({1: {2: {3: {4: 5, 5: 6}}}, 2: {3: 5, 4: 16}}) e = {1: {2: {3: {5: 7}}}, 2: {5: 1}} d.nested_update(e) assert (d == {1: {2: {3: {4: 5, 5: 7}}}, 2: {3: 5, 4: 16, 5: 1}}) d = NestedDict({1: {2: {3: {4: 5, 5: 6}}}, 2: {3: 5, 4: 16}}) e = NestedDict({1: {2: {3: {5: 7}}}, 2: {5: 1}}) d.nested_update(e) assert (d == {1: {2: {3: {4: 5, 5: 7}}}, 2: {3: 5, 4: 16, 5: 1}})
def test_nested_update_complex_keys(self): d = NestedDict({ (1, 2, 3): { (4, 3, 2): 1, 'hello': 'goodbye' }, 'a': { ('a', 'b', 'c'): 2 } }) e = {1: 2, (1, 2, 3): 4, 'hello': {'good': 'bye', 'bon': 'voyage'}} d.nested_update(e) assert (d == { 1: 2, (1, 2, 3): 4, 'hello': { 'good': 'bye', 'bon': 'voyage' }, 'a': { ('a', 'b', 'c'): 2 } })