Clean up test

This commit is contained in:
Jonathan Kim 2020-07-12 12:45:31 +01:00
parent be289d2855
commit a4c6838762
2 changed files with 4 additions and 25 deletions

View File

@ -348,7 +348,7 @@ class TypeMap(dict):
resolver = get_unbound_function(resolver)
# TODO wrap resolver
# Wrap resolver
def wrapped_resolver(*args, **kwargs):
result = resolver(*args, **kwargs)
return MapAsyncIterator(result, partial(map_payload_to_object, name))

View File

@ -1,44 +1,23 @@
from pytest import mark
from graphene import ObjectType, Int, String, Schema
from graphene.types.objecttype import ObjectTypeOptions
MYPY = False
if MYPY:
from typing import Callable # NOQA
class Query(ObjectType):
a = String()
class SubscriptionOptions(ObjectTypeOptions):
pass
class Subscription(ObjectType):
@classmethod
def __init_subclass_with_meta__(
cls, _meta=None, **options,
):
if not _meta:
_meta = SubscriptionOptions(cls)
count_to_ten = Int()
super().__init_subclass_with_meta__(_meta=_meta, **options)
class MySubscription(Subscription):
count_to_ten = Int(yes=Int())
async def subscribe_count_to_ten(root, info, **kwargs):
async def subscribe_count_to_ten(root, info):
count = 0
while count < 10:
count += 1
yield count
schema = Schema(query=Query, subscription=MySubscription)
schema = Schema(query=Query, subscription=Subscription)
@mark.asyncio