def test_xget_glob_keys_all(): # type: () -> None "Should get keys of dict" obj = {'foo': 1, 'bar': 2} resultset = dig.xget(obj, '*') textual = str(resultset) assert textual == '[foo=1:int, bar=2:int]'
def test_xget_glob_keys_some(): # type: () -> None "Should get keys of dict" assert str(dig.xget({ 'foo': 1, 'bar': 2, 'fx': 2 }, 'f*')) == '[foo=1:int, fx=2:int]'
def test_xget_glob_attrs_some(): # type: () -> None "Should get keys of object" assert str(dig.xget(E(foo=1, bar=2), 'f*')) == '[foo=1:int]'
def test_xget_glob_attrs_all(): # type: () -> None "Should get keys of dict" assert str(dig.xget(E(foo=1, bar=2), '*')) == '[bar=2:int, foo=1:int]'
def test_xget_glob_members_some(itr): # type: () -> None "Should get keys of a sequence/collection" assert str(dig.xget(itr, 'f*')) == "['foo', 'fx']"
def test_xget_fn(): # type: () -> None "Should get from function (?)" assert dig.xget(lambda x: x + 1, 1) == 2
def test_xget_object(): # type: () -> None "Should obj" assert dig.xget(E(foo='bar'), 'foo') == 'bar'
def test_xget_indexed_dict(): # type: () -> None "Does test_xget_indexed" assert dig.xget({'foo': 'bar'}, 'foo') == 'bar'
def test_xget_indexed_iter(): # type: () -> None "Does test_xget_indexed" assert dig.xget((1, 2, 3), 1) == 2
def test_xget_prim(param: Any) -> None: "Does test_xget_prim" result = dig.xget(param, 1) assert result == param or all(map(math.isnan, (param, result)))