mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-23 01:56:54 +03:00
Changed type resolver function name to _resolve_type. Fixed #50
This commit is contained in:
parent
a0d8b7162a
commit
7340d80fa6
|
@ -69,7 +69,7 @@ def test_node_replacedfield():
|
|||
|
||||
|
||||
def test_interface_resolve_type():
|
||||
resolve_type = Character.resolve_type(schema, Human())
|
||||
resolve_type = Character._resolve_type(schema, Human())
|
||||
assert isinstance(resolve_type, GraphQLObjectType)
|
||||
|
||||
|
||||
|
|
|
@ -13,7 +13,10 @@ class Character(Interface):
|
|||
|
||||
|
||||
class Pet(ObjectType):
|
||||
type = String(resolver=lambda *_: 'Dog')
|
||||
type = String()
|
||||
|
||||
def resolve_type(self, args, info):
|
||||
return 'Dog'
|
||||
|
||||
|
||||
class Human(Character):
|
||||
|
|
|
@ -182,7 +182,7 @@ class BaseObjectType(BaseType):
|
|||
signals.post_init.send(self.__class__, instance=self)
|
||||
|
||||
@classmethod
|
||||
def resolve_type(cls, schema, instance, *args):
|
||||
def _resolve_type(cls, schema, instance, *args):
|
||||
return schema.T(instance.__class__)
|
||||
|
||||
@classmethod
|
||||
|
@ -191,7 +191,7 @@ class BaseObjectType(BaseType):
|
|||
return GraphQLInterfaceType(
|
||||
cls._meta.type_name,
|
||||
description=cls._meta.description,
|
||||
resolve_type=partial(cls.resolve_type, schema),
|
||||
resolve_type=partial(cls._resolve_type, schema),
|
||||
fields=partial(cls.get_fields, schema)
|
||||
)
|
||||
elif cls._meta.is_union:
|
||||
|
|
|
@ -75,7 +75,7 @@ def test_union_cannot_initialize():
|
|||
|
||||
|
||||
def test_interface_resolve_type():
|
||||
resolve_type = Character.resolve_type(schema, Human(object()))
|
||||
resolve_type = Character._resolve_type(schema, Human(object()))
|
||||
assert isinstance(resolve_type, GraphQLObjectType)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user