Skip to content

Commit a667915

Browse files
committed
Minor clean-up
1 parent df94c8f commit a667915

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

gql/client.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,21 @@ def __init__(
2929
):
3030
assert not (
3131
type_def and introspection
32-
), "Can't provide introspection type definition at the same time"
32+
), "Cannot provide introspection type definition at the same time."
3333
if transport and fetch_schema_from_transport:
3434
assert (
3535
not schema
36-
), "Can't fetch the schema from transport if is already provided"
36+
), "Cannot fetch the schema from transport if is already provided"
3737
introspection = transport.execute(parse(introspection_query)).data
3838
if introspection:
39-
assert not schema, "Can't provide introspection and schema at the same time"
39+
assert (
40+
not schema
41+
), "Cannot provide introspection and schema at the same time."
4042
schema = build_client_schema(introspection)
4143
elif type_def:
4244
assert (
4345
not schema
44-
), "Can't provide Type definition and schema at the same time"
46+
), "Cannot provide type definition and schema at the same time."
4547
type_def_ast = parse(type_def)
4648
schema = build_ast_schema(type_def_ast)
4749
elif schema and not transport:
@@ -61,7 +63,7 @@ def __init__(
6163
def validate(self, document):
6264
if not self.schema:
6365
raise Exception(
64-
"Cannot validate locally the document, you need to pass a schema."
66+
"Cannot validate the document locally, you need to pass a schema."
6567
)
6668
validation_errors = validate(self.schema, document)
6769
if validation_errors:

tests/test_transport.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def client():
3131
URL, headers={"Host": "swapi.graphene-python.org", "Accept": "text/html"}
3232
)
3333
response.raise_for_status()
34-
csrf = response.cookies.get("csrftoken")
34+
csrf = response.cookies["csrftoken"]
3535
return Client(
3636
transport=RequestsHTTPTransport(
3737
url=URL, cookies={"csrftoken": csrf}, headers={"x-csrftoken": csrf}
@@ -97,7 +97,7 @@ def test_query_with_variable(client):
9797
assert result == expected
9898

9999

100-
def test_planet_query_with_name(client):
100+
def test_named_query(client):
101101
query = gql(
102102
"""
103103
query Planet1 {

0 commit comments

Comments
 (0)