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
def test_ls_safe(): actual = list(iter_ls(Universe())) assert ('answer', 42) not in actual
def test_ls_no_recursion(test_obj): expected = ['foo', 'lala'] actual = [x[0] for x in iter_ls(test_obj)] assert actual == expected
def test_ls_unsafe(): actual = list(iter_ls(Universe(), unsafe=True)) assert ('answer', 42) in actual