Exemplo n.º 1
0
def test_ls_recursive(test_obj):
    expected = [
        'foo.bar._something_else()',
        'foo.bar.something',
        "foo.baz['something_weird']",
        'lala.something',
    ]

    actual = [x[0] for x in iter_ls(test_obj, 'something', depth=4)]
    assert actual == expected
Exemplo n.º 2
0
def test_ls_safe():
    actual = list(iter_ls(Universe()))
    assert ('answer', 42) not in actual
Exemplo n.º 3
0
def test_ls_no_recursion(test_obj):
    expected = ['foo', 'lala']
    actual = [x[0] for x in iter_ls(test_obj)]
    assert actual == expected
Exemplo n.º 4
0
def test_ls_unsafe():
    actual = list(iter_ls(Universe(), unsafe=True))
    assert ('answer', 42) in actual