File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 12
12
def is_objecttype (cls ):
13
13
if not issubclass (cls , ObjectType ):
14
14
return False
15
- return not cls ._meta .interface
15
+ return not ( cls . _meta . abstract or cls ._meta .interface )
16
16
17
17
18
18
class ObjectTypeOptions (FieldsOptions ):
Original file line number Diff line number Diff line change @@ -87,3 +87,30 @@ class Thing(Human, Pet):
87
87
assert Thing ._meta .type_name == 'Thing'
88
88
assert Thing ._meta .description == 'Thing union description'
89
89
assert Thing .my_attr
90
+
91
+
92
+ def test_object_type_not_union_if_abstract ():
93
+ schema = Schema ()
94
+
95
+ class Query1 (ObjectType ):
96
+ field1 = String ()
97
+
98
+ class Meta :
99
+ abstract = True
100
+
101
+ class Query2 (ObjectType ):
102
+ field2 = String ()
103
+
104
+ class Meta :
105
+ abstract = True
106
+
107
+ class Query (Query1 , Query2 ):
108
+ '''Query description'''
109
+ my_attr = True
110
+
111
+ object_type = schema .T (Query )
112
+ assert issubclass (Query , ObjectType )
113
+ assert Query ._meta .type_name == 'Query'
114
+ assert Query ._meta .description == 'Query description'
115
+ assert isinstance (object_type , GraphQLObjectType )
116
+ assert list (Query ._meta .fields_map .keys ()) == ['field1' , 'field2' ]
You can’t perform that action at this time.
0 commit comments