Ejemplo n.º 1
0
def test_resolve():
    class X:
        pass

    x = X()
    x.y = X()
    x.y.z = X()
    x.y.z.t = 42
    x.a = 1
    b = 2

    assert resolve(x, 'y.z.t') == 42
    assert resolve(x, 'a') == 1
    assert resolve(b, '') == 2
Ejemplo n.º 2
0
def test_resolve():
    class X:
        pass

    x = X()
    x.y = X()
    x.y.z = X()
    x.y.z.t = 42
    x.a = 1
    b = 2

    assert resolve(x, 'y.z.t') == 42
    assert resolve(x, 'a') == 1
    assert resolve(b, '') == 2