From 51b281d04cad3688bb4d10ae59fce40406b7c638 Mon Sep 17 00:00:00 2001 From: Cameron Hurst Date: Mon, 1 Mar 2021 08:53:16 -0500 Subject: [PATCH] fix: black --- .../snap_test_objectidentification.py | 12 +++++-- graphene/types/tests/test_query.py | 33 +++++++++++++++---- graphene/types/tests/test_type_map.py | 16 +++++++-- 3 files changed, 48 insertions(+), 13 deletions(-) diff --git a/examples/starwars_relay/tests/snapshots/snap_test_objectidentification.py b/examples/starwars_relay/tests/snapshots/snap_test_objectidentification.py index 0e6b7c1c..d7694e90 100644 --- a/examples/starwars_relay/tests/snapshots/snap_test_objectidentification.py +++ b/examples/starwars_relay/tests/snapshots/snap_test_objectidentification.py @@ -8,7 +8,9 @@ from snapshottest import Snapshot snapshots = Snapshot() snapshots["test_correctly_fetches_id_name_rebels 1"] = { - "data": {"rebels": {"id": "RmFjdGlvbjox", "name": "Alliance to Restore the Republic"}} + "data": { + "rebels": {"id": "RmFjdGlvbjox", "name": "Alliance to Restore the Republic"} + } } snapshots["test_correctly_refetches_rebels 1"] = { @@ -19,9 +21,13 @@ snapshots["test_correctly_fetches_id_name_empire 1"] = { "data": {"empire": {"id": "RmFjdGlvbjoy", "name": "Galactic Empire"}} } -snapshots["test_correctly_refetches_empire 1"] = {"data": {"node": {"id": "RmFjdGlvbjoy", "name": "Galactic Empire"}}} +snapshots["test_correctly_refetches_empire 1"] = { + "data": {"node": {"id": "RmFjdGlvbjoy", "name": "Galactic Empire"}} +} -snapshots["test_correctly_refetches_xwing 1"] = {"data": {"node": {"id": "U2hpcDox", "name": "X-Wing"}}} +snapshots["test_correctly_refetches_xwing 1"] = { + "data": {"node": {"id": "U2hpcDox", "name": "X-Wing"}} +} snapshots[ "test_str_schema 1" diff --git a/graphene/types/tests/test_query.py b/graphene/types/tests/test_query.py index baf58542..e117754f 100644 --- a/graphene/types/tests/test_query.py +++ b/graphene/types/tests/test_query.py @@ -128,7 +128,9 @@ def test_query_interface(): executed = hello_schema.execute("{ interfaces { __typename } }") assert not executed.errors - assert executed.data == {"interfaces": [{"__typename": "One"}, {"__typename": "Two"}]} + assert executed.data == { + "interfaces": [{"__typename": "One"}, {"__typename": "Two"}] + } def test_query_dynamic(): @@ -177,7 +179,10 @@ def test_query_wrong_default_value(): executed = hello_schema.execute("{ hello { field } }") assert len(executed.errors) == 1 - assert executed.errors[0].message == GraphQLError("Expected value of type 'MyType' but got: 'hello'.").message + assert ( + executed.errors[0].message + == GraphQLError("Expected value of type 'MyType' but got: 'hello'.").message + ) assert executed.data == {"hello": None} @@ -259,9 +264,13 @@ def test_query_input_field(): assert not result.errors assert result.data == {"test": '["Source!",{"a_input":{"a_field":"String!"}}]'} - result = test_schema.execute('{ test(aInput: {recursiveField: {aField: "String!"}}) }', "Source!") + result = test_schema.execute( + '{ test(aInput: {recursiveField: {aField: "String!"}}) }', "Source!" + ) assert not result.errors - assert result.data == {"test": '["Source!",{"a_input":{"recursive_field":{"a_field":"String!"}}}]'} + assert result.data == { + "test": '["Source!",{"a_input":{"recursive_field":{"a_field":"String!"}}}]' + } def test_query_middlewares(): @@ -280,7 +289,9 @@ def test_query_middlewares(): hello_schema = Schema(Query) - executed = hello_schema.execute("{ hello, other }", middleware=[reversed_middleware]) + executed = hello_schema.execute( + "{ hello, other }", middleware=[reversed_middleware] + ) assert not executed.errors assert executed.data == {"hello": "dlroW", "other": "rehto"} @@ -386,7 +397,11 @@ def test_big_list_of_containers_multiple_fields_query_benchmark(benchmark): big_list_query = partial(hello_schema.execute, "{ allContainers { x, y, z, o } }") result = benchmark(big_list_query) assert not result.errors - assert result.data == {"allContainers": [{"x": c.x, "y": c.y, "z": c.z, "o": c.o} for c in big_container_list]} + assert result.data == { + "allContainers": [ + {"x": c.x, "y": c.y, "z": c.z, "o": c.o} for c in big_container_list + ] + } def test_big_list_of_containers_multiple_fields_custom_resolvers_query_benchmark( @@ -423,7 +438,11 @@ def test_big_list_of_containers_multiple_fields_custom_resolvers_query_benchmark big_list_query = partial(hello_schema.execute, "{ allContainers { x, y, z, o } }") result = benchmark(big_list_query) assert not result.errors - assert result.data == {"allContainers": [{"x": c.x, "y": c.y, "z": c.z, "o": c.o} for c in big_container_list]} + assert result.data == { + "allContainers": [ + {"x": c.x, "y": c.y, "z": c.z, "o": c.o} for c in big_container_list + ] + } def test_query_annotated_resolvers(): diff --git a/graphene/types/tests/test_type_map.py b/graphene/types/tests/test_type_map.py index fb59b78b..70bbe213 100644 --- a/graphene/types/tests/test_type_map.py +++ b/graphene/types/tests/test_type_map.py @@ -52,7 +52,9 @@ def test_enum(): assert graphql_enum.name == "MyEnum" assert graphql_enum.description == "Description" assert graphql_enum.values == { - "foo": GraphQLEnumValue(value=1, description="Description foo=1", deprecation_reason="Is deprecated"), + "foo": GraphQLEnumValue( + value=1, description="Description foo=1", deprecation_reason="Is deprecated" + ), "bar": GraphQLEnumValue(value=2, description="Description bar=2"), } @@ -226,7 +228,11 @@ def test_objecttype_camelcase(): assert list(fields) == ["fooBar"] foo_field = fields["fooBar"] assert isinstance(foo_field, GraphQLField) - assert foo_field.args == {"barFoo": GraphQLArgument(GraphQLString, default_value=Undefined, out_name="bar_foo")} + assert foo_field.args == { + "barFoo": GraphQLArgument( + GraphQLString, default_value=Undefined, out_name="bar_foo" + ) + } def test_objecttype_camelcase_disabled(): @@ -246,7 +252,11 @@ def test_objecttype_camelcase_disabled(): assert list(fields) == ["foo_bar"] foo_field = fields["foo_bar"] assert isinstance(foo_field, GraphQLField) - assert foo_field.args == {"bar_foo": GraphQLArgument(GraphQLString, default_value=Undefined, out_name="bar_foo")} + assert foo_field.args == { + "bar_foo": GraphQLArgument( + GraphQLString, default_value=Undefined, out_name="bar_foo" + ) + } def test_objecttype_with_possible_types():