mirror of
https://github.com/graphql-python/graphene.git
synced 2025-09-21 11:22:33 +03:00
Checked with flake8
This commit is contained in:
parent
cf365cc845
commit
f4f9af7490
|
@ -1,13 +1,14 @@
|
|||
from pytest import mark
|
||||
|
||||
from datetime import datetime
|
||||
from graphene import ObjectType, Int, String, Schema, Field
|
||||
|
||||
|
||||
class Query(ObjectType):
|
||||
hello = String()
|
||||
|
||||
def resolve_hello(root, info):
|
||||
return 'Hello, world!'
|
||||
return "Hello, world!"
|
||||
|
||||
|
||||
class Subscription(ObjectType):
|
||||
count_to_ten = Field(Int)
|
||||
|
@ -16,15 +17,17 @@ class Subscription(ObjectType):
|
|||
count = 0
|
||||
while count < 10:
|
||||
count += 1
|
||||
yield { 'count_to_ten': count }
|
||||
yield {"count_to_ten": count}
|
||||
|
||||
|
||||
schema = Schema(query=Query, subscription=Subscription)
|
||||
|
||||
|
||||
@mark.asyncio
|
||||
async def test_subscription():
|
||||
subscription = 'subscription { countToTen }'
|
||||
subscription = "subscription { countToTen }"
|
||||
result = await schema.subscribe(subscription)
|
||||
count = 0
|
||||
async for item in result:
|
||||
count = item.data['countToTen']
|
||||
count = item.data["countToTen"]
|
||||
assert count == 10
|
||||
|
|
Loading…
Reference in New Issue
Block a user