Skip to content

Commit 9c3e4bb

Browse files
authored
Merge pull request #1421 from Cito/upgrade-dev-env
Make Graphene compatible with GraphQL-Core 3.2
2 parents 4e8a1e6 + 9e7e08d commit 9c3e4bb

File tree

17 files changed

+80
-89
lines changed

17 files changed

+80
-89
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ default_language_version:
33

44
repos:
55
- repo: https://github.com/pre-commit/pre-commit-hooks
6-
rev: v4.1.0
6+
rev: v4.2.0
77
hooks:
88
- id: check-merge-conflict
99
- id: check-json
@@ -17,11 +17,11 @@ repos:
1717
- id: trailing-whitespace
1818
exclude: README.md
1919
- repo: https://github.com/asottile/pyupgrade
20-
rev: v2.31.0
20+
rev: v2.32.1
2121
hooks:
2222
- id: pyupgrade
2323
- repo: https://github.com/ambv/black
24-
rev: 21.12b0
24+
rev: 22.3.0
2525
hooks:
2626
- id: black
2727
- repo: https://github.com/PyCQA/flake8

docs/conf.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,18 @@
6464
master_doc = "index"
6565

6666
# General information about the project.
67-
project = u"Graphene"
68-
copyright = u"Graphene 2016"
69-
author = u"Syrus Akbary"
67+
project = "Graphene"
68+
copyright = "Graphene 2016"
69+
author = "Syrus Akbary"
7070

7171
# The version info for the project you're documenting, acts as replacement for
7272
# |version| and |release|, also used in various other places throughout the
7373
# built documents.
7474
#
7575
# The short X.Y version.
76-
version = u"1.0"
76+
version = "1.0"
7777
# The full version, including alpha/beta/rc tags.
78-
release = u"1.0"
78+
release = "1.0"
7979

8080
# The language for content autogenerated by Sphinx. Refer to documentation
8181
# for a list of supported languages.
@@ -278,7 +278,7 @@
278278
# (source start file, target name, title,
279279
# author, documentclass [howto, manual, or own class]).
280280
latex_documents = [
281-
(master_doc, "Graphene.tex", u"Graphene Documentation", u"Syrus Akbary", "manual")
281+
(master_doc, "Graphene.tex", "Graphene Documentation", "Syrus Akbary", "manual")
282282
]
283283

284284
# The name of an image file (relative to this directory) to place at the top of
@@ -318,7 +318,7 @@
318318

319319
# One entry per manual page. List of tuples
320320
# (source start file, name, description, authors, manual section).
321-
man_pages = [(master_doc, "graphene", u"Graphene Documentation", [author], 1)]
321+
man_pages = [(master_doc, "graphene", "Graphene Documentation", [author], 1)]
322322

323323
# If true, show URL addresses after external links.
324324
#
@@ -334,7 +334,7 @@
334334
(
335335
master_doc,
336336
"Graphene",
337-
u"Graphene Documentation",
337+
"Graphene Documentation",
338338
author,
339339
"Graphene",
340340
"One line description of project.",

examples/starwars_relay/tests/snapshots/snap_test_objectidentification.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,5 +115,4 @@
115115
shipName: String!
116116
factionId: String!
117117
clientMutationId: String
118-
}
119-
'''
118+
}'''

examples/starwars_relay/tests/test_objectidentification.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
def test_str_schema(snapshot):
12-
snapshot.assert_match(str(schema))
12+
snapshot.assert_match(str(schema).strip())
1313

1414

1515
def test_correctly_fetches_id_name_rebels(snapshot):

graphene/relay/tests/test_node.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import re
2-
from graphql_relay import to_global_id
2+
from textwrap import dedent
33

4-
from graphene.tests.utils import dedent
4+
from graphql_relay import to_global_id
55

66
from ...types import ObjectType, Schema, String
77
from ..node import Node, is_node
@@ -171,8 +171,10 @@ def test_node_field_only_lazy_type_wrong():
171171

172172

173173
def test_str_schema():
174-
assert str(schema) == dedent(
175-
'''
174+
assert (
175+
str(schema).strip()
176+
== dedent(
177+
'''
176178
schema {
177179
query: RootQuery
178180
}
@@ -213,4 +215,5 @@ def test_str_schema():
213215
): MyNode
214216
}
215217
'''
218+
).strip()
216219
)

graphene/relay/tests/test_node_custom.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
from graphql import graphql_sync
1+
from textwrap import dedent
22

3-
from graphene.tests.utils import dedent
3+
from graphql import graphql_sync
44

55
from ...types import Interface, ObjectType, Schema
66
from ...types.scalars import Int, String
@@ -54,8 +54,10 @@ class RootQuery(ObjectType):
5454

5555

5656
def test_str_schema_correct():
57-
assert str(schema) == dedent(
58-
'''
57+
assert (
58+
str(schema).strip()
59+
== dedent(
60+
'''
5961
schema {
6062
query: RootQuery
6163
}
@@ -93,6 +95,7 @@ def test_str_schema_correct():
9395
): Node
9496
}
9597
'''
98+
).strip()
9699
)
97100

98101

graphene/test/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
from promise import Promise, is_thenable
2-
from graphql.error import format_error as format_graphql_error
32
from graphql.error import GraphQLError
43

54
from graphene.types.schema import Schema
65

76

87
def default_format_error(error):
98
if isinstance(error, GraphQLError):
10-
return format_graphql_error(error)
9+
return error.formatted
1110
return {"message": str(error)}
1211

1312

graphene/tests/utils.py

Lines changed: 0 additions & 9 deletions
This file was deleted.

graphene/types/definitions.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
GraphQLObjectType,
88
GraphQLScalarType,
99
GraphQLUnionType,
10-
Undefined,
1110
)
1211

1312

@@ -50,7 +49,7 @@ def serialize(self, value):
5049
try:
5150
value = enum[value]
5251
except KeyError:
53-
return Undefined
52+
pass
5453
return super(GrapheneEnumType, self).serialize(value)
5554

5655

graphene/types/scalars.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class String(Scalar):
143143
@staticmethod
144144
def coerce_string(value):
145145
if isinstance(value, bool):
146-
return u"true" if value else u"false"
146+
return "true" if value else "false"
147147
return str(value)
148148

149149
serialize = coerce_string

0 commit comments

Comments
 (0)