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):
115
115
connection_type = type
116
116
assert issubclass (connection_type , Connection ), (
117
117
'{} type have to be a subclass of Connection. Received "{}".'
118
- ).format (str ( self ) , connection_type )
118
+ ).format (self . __class__ . __name__ , connection_type )
119
119
return connection_type
120
120
121
121
@classmethod
Original file line number Diff line number Diff line change @@ -12,9 +12,9 @@ def is_node(objecttype):
12
12
'''
13
13
Check if the given objecttype has Node as an interface
14
14
'''
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
+
18
18
for i in objecttype ._meta .interfaces :
19
19
if issubclass (i , Node ):
20
20
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