Example #1
0
def test_mod_one_out_of_many_keys():
    k = nd.NestedDict({'a': {'b': {'c': {'e': 123}}}, 'd': {'e': 123}, 'f': {'c': {'e': 123}}})

    k['a/b/c/e'] = 234
    assert k == {'a': {'b': {'c': {'e': 234}}}, 'd': {'e': 123}, 'f': {'c': {'e': 123}}}

    k['b/c/e'] = 345
    assert k == {'a': {'b': {'c': {'e': 345}}}, 'd': {'e': 123}, 'f': {'c': {'e': 123}}}
Example #2
0
def n():
    return nd.NestedDict({
        'a': {
            'b': {
                'c': 123
            }
        },
        'd': {
            'e': 456
        },
        'f': {
            'e': 789
        }
    })
Example #3
0
def n():
    return nd.NestedDict()
Example #4
0
def test_mod_ambiguous_key():
    k = nd.NestedDict({'a': {'b': {'c': {'e': 123}}}, 'd': {'e': 123}, 'f': {'c': {'e': 123}}})

    with raises(KeyError):
        k['c/e'] = 456
def x():
    return nd.NestedDict()
def c():
    val = nd.NestedDict()
    val[123] = 'abc'
    val[456] = 'def'
    val[789] = 'ghi'
    return val