Skip to content

Commit bd6c36f

Browse files
committed
review fiexes.
1 parent 70866d7 commit bd6c36f

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

tests/execution/test_middleware.py

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

44
import pytest
55
from graphql.execution import Middleware, MiddlewareManager, execute, subscribe
6-
from graphql.execution import Middleware, MiddlewareManager, execute
76
from graphql.language.parser import parse
87
from graphql.type import GraphQLField, GraphQLObjectType, GraphQLSchema, GraphQLString
98

109

11-
def _create_subscription_schema(tp: GraphQLObjectType) -> GraphQLSchema:
12-
noop_type = GraphQLObjectType(
13-
"Noop", {"noop": GraphQLField(GraphQLString, resolve=lambda *_: "noop")}
14-
)
15-
return GraphQLSchema(query=noop_type, subscription=tp)
16-
17-
1810
def describe_middleware():
1911
def describe_with_manager():
2012
def default():
@@ -247,7 +239,6 @@ async def resolve(self, next_, *args, **kwargs):
247239

248240
@pytest.mark.asyncio()
249241
async def subscription_simple():
250-
251242
async def bar_resolve(_obj, _info):
252243
yield "bar"
253244
yield "oof"
@@ -268,8 +259,14 @@ async def reverse_middleware(next_, value, info, **kwargs):
268259
awaitable_maybe = next_(value, info, **kwargs)
269260
return awaitable_maybe[::-1]
270261

262+
noop_type = GraphQLObjectType(
263+
"Noop",
264+
{"noop": GraphQLField(GraphQLString, resolve=lambda *_args: "noop")},
265+
)
266+
schema = GraphQLSchema(query=noop_type, subscription=test_type)
267+
271268
agen = subscribe(
272-
_create_subscription_schema(test_type),
269+
schema,
273270
doc,
274271
middleware=MiddlewareManager(reverse_middleware),
275272
)

0 commit comments

Comments
 (0)