Skip to content

Make tests work with GraphQL-core 3.2.0rc2 #1378

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/starwars_relay/tests/test_objectidentification.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


def test_str_schema(snapshot):
snapshot.assert_match(str(schema))
snapshot.assert_match(str(schema).rstrip() + "\n")


def test_correctly_fetches_id_name_rebels(snapshot):
Expand Down
2 changes: 1 addition & 1 deletion graphene/relay/tests/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def test_node_field_only_lazy_type_wrong():


def test_str_schema():
assert str(schema) == dedent(
assert str(schema).rstrip() + "\n" == dedent(
'''
schema {
query: RootQuery
Expand Down
2 changes: 1 addition & 1 deletion graphene/relay/tests/test_node_custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class RootQuery(ObjectType):


def test_str_schema_correct():
assert str(schema) == dedent(
assert str(schema).rstrip() + "\n" == dedent(
'''
schema {
query: RootQuery
Expand Down
7 changes: 1 addition & 6 deletions graphene/types/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,12 +381,7 @@ def resolve_type(self, resolve_type_func, type_name, root, info, _type):
return default_type_resolver(root, info, return_type)

if inspect.isclass(type_) and issubclass(type_, ObjectType):
graphql_type = self.get(type_._meta.name)
assert graphql_type, f"Can't find type {type_._meta.name} in schema"
assert (
graphql_type.graphene_type == type_
), f"The type {type_} does not match with the associated graphene type {graphql_type.graphene_type}."
return graphql_type
return type_._meta.name

return type_

Expand Down
8 changes: 3 additions & 5 deletions graphene/types/tests/test_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def resolve_color(_, info):

schema = Schema(query=Query)

assert str(schema) == dedent(
assert str(schema).rstrip() + "\n" == dedent(
'''\
type Query {
color: Color!
Expand Down Expand Up @@ -345,10 +345,8 @@ def resolve_color(_, info):

results = schema.execute("query { color }")
assert results.errors
assert (
results.errors[0].message
== "Expected a value of type 'Color' but received: 'BLACK'"
)
message = results.errors[0].message
assert "Expected" in message and "Color" in message and "BLACK" in message


def test_field_enum_argument():
Expand Down
2 changes: 1 addition & 1 deletion graphene/types/tests/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_schema_get_type_error():

def test_schema_str():
schema = Schema(Query)
assert str(schema) == dedent(
assert str(schema).rstrip() + "\n" == dedent(
"""
type Query {
inner: MyOtherType
Expand Down
2 changes: 1 addition & 1 deletion graphene/types/union.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ def resolve_type(cls, instance, info):
from .objecttype import ObjectType # NOQA

if isinstance(instance, ObjectType):
return type(instance)
return instance._meta.name
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def run_tests(self):
keywords="api graphql protocol rest relay graphene",
packages=find_packages(exclude=["examples*"]),
install_requires=[
"graphql-core~=3.1.2",
"graphql-core>=3.1.2,<3.3",
"graphql-relay>=3.0,<4",
"aniso8601>=8,<10",
],
Expand Down