Example #1
0
def test_copy_default_factory():
    undefined = lambda: object()
    m = DefaultFactoryMunch.fromDict({'urmom': {'sez': {'what': 'what'}}}, undefined)
    c = m.copy()
    assert c is not m
    assert c.urmom is not m.urmom
    assert c.urmom.sez is not m.urmom.sez
    assert c.urmom.sez.what == 'what'
    assert c == m
Example #2
0
def test_copy_default_factory():
    undefined = lambda: object()
    m = DefaultFactoryMunch.fromDict({'urmom': {'sez': {'what': 'what'}}}, undefined)
    c = m.copy()
    assert c is not m
    assert c.urmom is not m.urmom
    assert c.urmom.sez is not m.urmom.sez
    assert c.urmom.sez.what == 'what'
    assert c == m
Example #3
0
def test_fromDict_default_factory():
    obj = object()
    undefined = lambda: obj
    b = DefaultFactoryMunch.fromDict({'urmom': {
        'sez': {
            'what': 'what'
        }
    }}, undefined)
    assert b.urmom.sez.what == 'what'
    assert b.urmom.sez.foo is undefined()
Example #4
0
def test_fromDict_default_factory():
    obj = object()
    undefined = lambda: obj
    b = DefaultFactoryMunch.fromDict({'urmom': {'sez': {'what': 'what'}}}, undefined)
    assert b.urmom.sez.what == 'what'
    assert b.urmom.sez.foo is undefined()