def test_updating_context_with_context(self): context1 = Context({'key1': 1}) context2 = Context({'key2': 2}) context1.update(context2) expected_result = Context({'key1': 1, 'key2': 2}) assert context1 == expected_result
def test_update(self): one_conf_dict = { 'key1': 'value1', 1: 'value2', 2: { 1: 'some_value' }, } another_conf_dict = { 'key3': ('one', 'two', 'three'), 'key4': { 1: 'uno', 'key4-2': 'dos' }, } merged_conf_dicts = { 'key1': 'value1', 1: 'value2', 2: { 1: 'some_value' }, 'key3': ('one', 'two', 'three'), 'key4': { 1: 'uno', 'key4-2': 'dos' }, } config = Context(one_conf_dict) config.update(another_conf_dict) assert config == merged_conf_dicts