def test_can_parse_empty_query(): query = Query("") assert str(query) == "" assert query.string == "" assert dict(query) == {} assert len(query) == 0 assert not query.__bool__() assert not query.__nonzero__()
def test_can_parse_none_query(): query = Query(None) assert str(query) == "" assert query.string is None assert dict(query) == {} assert len(query) == 0 assert not query.__bool__() assert not query.__nonzero__()
def test_can_parse_key_value_query(): query = Query("foo=bar") assert str(query) == "foo=bar" assert query.string == "foo=bar" assert dict(query) == {"foo": "bar"} assert query.get("foo") == "bar" assert len(query) == 1 assert query.__bool__() assert query.__nonzero__()
def test_can_parse_key_only_query(): query = Query("foo") assert str(query) == "foo" assert query.string == "foo" assert dict(query) == {"foo": None} assert query.get("foo") is None assert len(query) == 1 assert query.__bool__() assert query.__nonzero__()