def test_query_dict_items(): d = models.QueryDict(_default_query) items = d.items() assert inspect.isgenerator(items) assert dict(items) == { "q": "{ hello }", "name": "myname", "user_name": "test_user" }
def test_query_dict_items_list(): d = models.QueryDict(_default_query) items_list = d.items_list() assert inspect.isgenerator(items_list) assert dict(items_list) == { "q": ["{ hello }"], "name": ["myname"], "user_name": ["test_user"], }
def test_query_dict_get(): d = models.QueryDict(_default_query) assert d["user_name"] == "test_user" assert d.get("key_none_exist") is None
def test_query_dict_get_list(): d = models.QueryDict(_default_query) assert d.get_list("user_name") == ["test_user"] assert d.get_list("key_none_exist") == [] assert d.get_list("key_none_exist", ["foo"]) == ["foo"]
def test_query_dict(query, expected): d = models.QueryDict(query) assert d == expected