def test_one_key(self): container = {} key = "somekey" value = "somevalue" set_nested_keys(container, [key], value) assert container[key] == value assert list(container.keys()) == [key]
def test_three_keys(self): container = {} key1, key2, key3 = "somekey1", "somekey2", "somekey3" value = "somevalue" set_nested_keys(container, [key1, key2, key3], value) assert container[key1][key2][key3] == value assert list(container.keys()) == [key1]