mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-22 01:26:49 +03:00
Clean up test
This commit is contained in:
parent
be289d2855
commit
a4c6838762
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user