mirror of
https://github.com/graphql-python/graphene.git
synced 2025-09-21 11:22:33 +03:00
Update dependencies, reformat changes with black
This commit is contained in:
parent
b3b9b4fc9e
commit
55c7a67275
|
@ -23,6 +23,6 @@ repos:
|
|||
- id: black
|
||||
language_version: python3
|
||||
- repo: https://github.com/PyCQA/flake8
|
||||
rev: 3.7.7
|
||||
rev: 3.7.8
|
||||
hooks:
|
||||
- id: flake8
|
||||
|
|
|
@ -45,8 +45,11 @@ class PageInfo(ObjectType):
|
|||
def page_info_adapter(startCursor, endCursor, hasPreviousPage, hasNextPage):
|
||||
"""Adapter for creating PageInfo instances"""
|
||||
return PageInfo(
|
||||
start_cursor=startCursor, end_cursor=endCursor,
|
||||
has_previous_page=hasPreviousPage, has_next_page=hasNextPage)
|
||||
start_cursor=startCursor,
|
||||
end_cursor=endCursor,
|
||||
has_previous_page=hasPreviousPage,
|
||||
has_next_page=hasNextPage,
|
||||
)
|
||||
|
||||
|
||||
class ConnectionOptions(ObjectTypeOptions):
|
||||
|
|
|
@ -29,9 +29,7 @@ class ClientIDMutation(Mutation):
|
|||
cls.Input = type(
|
||||
"{}Input".format(base_name),
|
||||
bases,
|
||||
dict(
|
||||
input_fields, client_mutation_id=String(name="clientMutationId")
|
||||
),
|
||||
dict(input_fields, client_mutation_id=String(name="clientMutationId")),
|
||||
)
|
||||
|
||||
arguments = dict(
|
||||
|
|
|
@ -71,9 +71,7 @@ class AbstractNode(Interface):
|
|||
@classmethod
|
||||
def __init_subclass_with_meta__(cls, **options):
|
||||
_meta = InterfaceOptions(cls)
|
||||
_meta.fields = {
|
||||
'id': GlobalID(cls, description="The ID of the object")
|
||||
}
|
||||
_meta.fields = {"id": GlobalID(cls, description="The ID of the object")}
|
||||
super(AbstractNode, cls).__init_subclass_with_meta__(_meta=_meta, **options)
|
||||
|
||||
|
||||
|
|
|
@ -134,7 +134,9 @@ async def test_respects_an_overly_large_last():
|
|||
|
||||
@mark.asyncio
|
||||
async def test_respects_first_and_after():
|
||||
await check('first: 2, after: "{}"'.format(cursor_for("B")), "CD", has_next_page=True)
|
||||
await check(
|
||||
'first: 2, after: "{}"'.format(cursor_for("B")), "CD", has_next_page=True
|
||||
)
|
||||
|
||||
|
||||
@mark.asyncio
|
||||
|
@ -144,7 +146,9 @@ async def test_respects_first_and_after_with_long_first():
|
|||
|
||||
@mark.asyncio
|
||||
async def test_respects_last_and_before():
|
||||
await check('last: 2, before: "{}"'.format(cursor_for("D")), "BC", has_previous_page=True)
|
||||
await check(
|
||||
'last: 2, before: "{}"'.format(cursor_for("D")), "BC", has_previous_page=True
|
||||
)
|
||||
|
||||
|
||||
@mark.asyncio
|
||||
|
|
|
@ -74,7 +74,7 @@ def test_subclassed_node_query():
|
|||
"node": {
|
||||
"shared": "1",
|
||||
"extraField": "extra field info.",
|
||||
"somethingElse": "----"
|
||||
"somethingElse": "----",
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ def test_node_field_only_lazy_type_wrong():
|
|||
|
||||
|
||||
def test_str_schema():
|
||||
assert (str(schema) == dedent(
|
||||
assert str(schema) == dedent(
|
||||
'''
|
||||
schema {
|
||||
query: RootQuery
|
||||
|
@ -182,5 +182,5 @@ def test_str_schema():
|
|||
"""The ID of the object"""
|
||||
onlyNodeLazy(id: ID!): MyNode
|
||||
}
|
||||
''')
|
||||
'''
|
||||
)
|
||||
|
|
|
@ -53,7 +53,7 @@ graphql_schema = schema.graphql_schema
|
|||
|
||||
|
||||
def test_str_schema_correct():
|
||||
assert (str(schema) == dedent(
|
||||
assert str(schema) == dedent(
|
||||
'''
|
||||
schema {
|
||||
query: RootQuery
|
||||
|
@ -89,7 +89,7 @@ def test_str_schema_correct():
|
|||
"""The full name of the user"""
|
||||
name: String
|
||||
}
|
||||
''')
|
||||
'''
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -85,7 +85,8 @@ def test_bad_datetime_query():
|
|||
error = result.errors[0]
|
||||
assert isinstance(error, GraphQLError)
|
||||
assert error.message == (
|
||||
"Expected type DateTime, found \"Some string that's not a datetime\".")
|
||||
'Expected type DateTime, found "Some string that\'s not a datetime".'
|
||||
)
|
||||
assert result.data is None
|
||||
|
||||
|
||||
|
@ -97,7 +98,8 @@ def test_bad_date_query():
|
|||
error = result.errors[0]
|
||||
assert isinstance(error, GraphQLError)
|
||||
assert error.message == (
|
||||
"Expected type Date, found \"Some string that's not a date\".")
|
||||
'Expected type Date, found "Some string that\'s not a date".'
|
||||
)
|
||||
assert result.data is None
|
||||
|
||||
|
||||
|
@ -109,7 +111,8 @@ def test_bad_time_query():
|
|||
error = result.errors[0]
|
||||
assert isinstance(error, GraphQLError)
|
||||
assert error.message == (
|
||||
"Expected type Time, found \"Some string that's not a time\".")
|
||||
'Expected type Time, found "Some string that\'s not a time".'
|
||||
)
|
||||
assert result.data is None
|
||||
|
||||
|
||||
|
|
|
@ -85,10 +85,14 @@ def test_enum_from_builtin_enum_accepts_lambda_description():
|
|||
episode = schema.get_type("PyEpisode")
|
||||
|
||||
assert episode.description == "StarWars Episodes"
|
||||
assert [(name, value.description, value.deprecation_reason)
|
||||
for name, value in episode.values.items()] == [
|
||||
('NEWHOPE', 'New Hope Episode', 'meh'),
|
||||
('EMPIRE', 'Other', None), ('JEDI', 'Other', None)]
|
||||
assert [
|
||||
(name, value.description, value.deprecation_reason)
|
||||
for name, value in episode.values.items()
|
||||
] == [
|
||||
("NEWHOPE", "New Hope Episode", "meh"),
|
||||
("EMPIRE", "Other", None),
|
||||
("JEDI", "Other", None),
|
||||
]
|
||||
|
||||
|
||||
def test_enum_from_python3_enum_uses_enum_doc():
|
||||
|
|
|
@ -146,11 +146,7 @@ def test_parent_container_get_fields():
|
|||
|
||||
|
||||
def test_parent_container_interface_get_fields():
|
||||
assert list(ContainerWithInterface._meta.fields) == [
|
||||
"ifield",
|
||||
"field1",
|
||||
"field2",
|
||||
]
|
||||
assert list(ContainerWithInterface._meta.fields) == ["ifield", "field1", "field2"]
|
||||
|
||||
|
||||
def test_objecttype_as_container_only_args():
|
||||
|
|
|
@ -263,7 +263,8 @@ def test_query_input_field():
|
|||
result = test_schema.execute('{ test(aInput: {aField: "String!"} ) }', "Source!")
|
||||
assert not result.errors
|
||||
assert result.data == {
|
||||
"test": '["Source!",{"a_input":{"a_field":"String!","recursive_field":null}}]'}
|
||||
"test": '["Source!",{"a_input":{"a_field":"String!","recursive_field":null}}]'
|
||||
}
|
||||
|
||||
result = test_schema.execute(
|
||||
'{ test(aInput: {recursiveField: {aField: "String!"}}) }', "Source!"
|
||||
|
|
|
@ -53,10 +53,10 @@ def test_enum():
|
|||
assert graphql_enum.name == "MyEnum"
|
||||
assert graphql_enum.description == "Description"
|
||||
assert graphql_enum.values == {
|
||||
'foo': GraphQLEnumValue(
|
||||
"foo": GraphQLEnumValue(
|
||||
value=1, description="Description foo=1", deprecation_reason="Is deprecated"
|
||||
),
|
||||
'bar': GraphQLEnumValue(value=2, description="Description bar=2"),
|
||||
"bar": GraphQLEnumValue(value=2, description="Description bar=2"),
|
||||
}
|
||||
|
||||
|
||||
|
@ -230,11 +230,7 @@ def test_objecttype_camelcase():
|
|||
foo_field = fields["fooBar"]
|
||||
assert isinstance(foo_field, GraphQLField)
|
||||
assert foo_field.args == {
|
||||
"barFoo": GraphQLArgument(
|
||||
GraphQLString,
|
||||
default_value=None,
|
||||
out_name="bar_foo"
|
||||
)
|
||||
"barFoo": GraphQLArgument(GraphQLString, default_value=None, out_name="bar_foo")
|
||||
}
|
||||
|
||||
|
||||
|
@ -257,9 +253,7 @@ def test_objecttype_camelcase_disabled():
|
|||
assert isinstance(foo_field, GraphQLField)
|
||||
assert foo_field.args == {
|
||||
"bar_foo": GraphQLArgument(
|
||||
GraphQLString,
|
||||
default_value=None,
|
||||
out_name="bar_foo"
|
||||
GraphQLString, default_value=None, out_name="bar_foo"
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -42,11 +42,7 @@ from ..crunch import crunch
|
|||
],
|
||||
[
|
||||
"complex object",
|
||||
{
|
||||
"a": True,
|
||||
"b": [1, 2, 3],
|
||||
"c": {"a": True, "b": [1, 2, 3]},
|
||||
},
|
||||
{"a": True, "b": [1, 2, 3], "c": {"a": True, "b": [1, 2, 3]}},
|
||||
[True, 1, 2, 3, [1, 2, 3], {"a": 0, "b": 4}, {"a": 0, "b": 4, "c": 5}],
|
||||
],
|
||||
],
|
||||
|
|
|
@ -109,7 +109,7 @@ async def test_connection_async():
|
|||
}
|
||||
}
|
||||
}
|
||||
""",
|
||||
"""
|
||||
)
|
||||
|
||||
assert not result.errors
|
||||
|
|
|
@ -66,7 +66,7 @@ schema = Schema(query=RootQuery, mutation=Mutation)
|
|||
@mark.asyncio
|
||||
async def test_node_query_promise():
|
||||
executed = await schema.execute_async(
|
||||
'mutation a { sayPromise(input: {what:"hello", clientMutationId:"1"}) { phrase } }',
|
||||
'mutation a { sayPromise(input: {what:"hello", clientMutationId:"1"}) { phrase } }'
|
||||
)
|
||||
assert not executed.errors
|
||||
assert executed.data == {"sayPromise": {"phrase": "hello"}}
|
||||
|
@ -75,7 +75,7 @@ async def test_node_query_promise():
|
|||
@mark.asyncio
|
||||
async def test_edge_query():
|
||||
executed = await schema.execute_async(
|
||||
'mutation a { other(input: {clientMutationId:"1"}) { clientMutationId, myNodeEdge { cursor node { name }} } }',
|
||||
'mutation a { other(input: {clientMutationId:"1"}) { clientMutationId, myNodeEdge { cursor node { name }} } }'
|
||||
)
|
||||
assert not executed.errors
|
||||
assert dict(executed.data) == {
|
||||
|
|
Loading…
Reference in New Issue
Block a user