Skip to content

Commit 7340d80

Browse files
committed
Changed type resolver function name to _resolve_type. Fixed #50
1 parent a0d8b71 commit 7340d80

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

graphene/contrib/django/tests/test_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def test_node_replacedfield():
6969

7070

7171
def test_interface_resolve_type():
72-
resolve_type = Character.resolve_type(schema, Human())
72+
resolve_type = Character._resolve_type(schema, Human())
7373
assert isinstance(resolve_type, GraphQLObjectType)
7474

7575

graphene/core/tests/test_query.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ class Character(Interface):
1313

1414

1515
class Pet(ObjectType):
16-
type = String(resolver=lambda *_: 'Dog')
16+
type = String()
17+
18+
def resolve_type(self, args, info):
19+
return 'Dog'
1720

1821

1922
class Human(Character):

graphene/core/types/objecttype.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def __init__(self, *args, **kwargs):
182182
signals.post_init.send(self.__class__, instance=self)
183183

184184
@classmethod
185-
def resolve_type(cls, schema, instance, *args):
185+
def _resolve_type(cls, schema, instance, *args):
186186
return schema.T(instance.__class__)
187187

188188
@classmethod
@@ -191,7 +191,7 @@ def internal_type(cls, schema):
191191
return GraphQLInterfaceType(
192192
cls._meta.type_name,
193193
description=cls._meta.description,
194-
resolve_type=partial(cls.resolve_type, schema),
194+
resolve_type=partial(cls._resolve_type, schema),
195195
fields=partial(cls.get_fields, schema)
196196
)
197197
elif cls._meta.is_union:

graphene/core/types/tests/test_objecttype.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def test_union_cannot_initialize():
7575

7676

7777
def test_interface_resolve_type():
78-
resolve_type = Character.resolve_type(schema, Human(object()))
78+
resolve_type = Character._resolve_type(schema, Human(object()))
7979
assert isinstance(resolve_type, GraphQLObjectType)
8080

8181

0 commit comments

Comments
 (0)