File tree Expand file tree Collapse file tree 3 files changed +28
-4
lines changed
Expand file tree Collapse file tree 3 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ def type(self):
115115 connection_type = type
116116 assert issubclass (connection_type , Connection ), (
117117 '{} type have to be a subclass of Connection. Received "{}".'
118- ).format (str ( self ) , connection_type )
118+ ).format (self . __class__ . __name__ , connection_type )
119119 return connection_type
120120
121121 @classmethod
Original file line number Diff line number Diff line change @@ -12,9 +12,9 @@ def is_node(objecttype):
1212 '''
1313 Check if the given objecttype has Node as an interface
1414 '''
15- assert issubclass (objecttype , ObjectType ), (
16- 'Only ObjectTypes can have a Node interface. Received %s'
17- ) % objecttype
15+ if not issubclass (objecttype , ObjectType ):
16+ return False
17+
1818 for i in objecttype ._meta .interfaces :
1919 if issubclass (i , Node ):
2020 return True
Original file line number Diff line number Diff line change 1+ # https://github.com/graphql-python/graphene/issues/356
2+
3+ import pytest
4+ import graphene
5+ from graphene import relay
6+
7+ class SomeTypeOne (graphene .ObjectType ):
8+ pass
9+
10+ class SomeTypeTwo (graphene .ObjectType ):
11+ pass
12+
13+ class MyUnion (graphene .Union ):
14+ class Meta :
15+ types = (SomeTypeOne , SomeTypeTwo )
16+
17+ def test_issue ():
18+ with pytest .raises (Exception ) as exc_info :
19+ class Query (graphene .ObjectType ):
20+ things = relay .ConnectionField (MyUnion )
21+
22+ schema = graphene .Schema (query = Query )
23+
24+ assert str (exc_info .value ) == 'IterableConnectionField type have to be a subclass of Connection. Received "MyUnion".'
You can’t perform that action at this time.
0 commit comments