@@ -204,52 +204,79 @@ def returns_false_for_a_not_non_null_wrapped_type():
204
204
assert_non_null_type (GraphQLList (GraphQLNonNull (ObjectType )))
205
205
206
206
def describe_is_input_type ():
207
+ def _assert_input_type (type_ ):
208
+ assert is_input_type (type_ ) is True
209
+ assert_input_type (type_ )
210
+
207
211
def returns_true_for_an_input_type ():
208
- assert is_input_type (InputObjectType ) is True
209
- assert_input_type (InputObjectType )
212
+ _assert_input_type (GraphQLString )
213
+ _assert_input_type (EnumType )
214
+ _assert_input_type (InputObjectType )
210
215
211
216
def returns_true_for_a_wrapped_input_type ():
212
- assert is_input_type (GraphQLList (InputObjectType )) is True
213
- assert_input_type (GraphQLList (InputObjectType ))
214
- assert is_input_type (GraphQLNonNull (InputObjectType )) is True
215
- assert_input_type (GraphQLNonNull (InputObjectType ))
217
+ _assert_input_type (GraphQLList (GraphQLString ))
218
+ _assert_input_type (GraphQLList (EnumType ))
219
+ _assert_input_type (GraphQLList (InputObjectType ))
216
220
217
- def returns_false_for_an_output_type ():
218
- assert is_input_type (ObjectType ) is False
221
+ _assert_input_type (GraphQLNonNull (GraphQLString ))
222
+ _assert_input_type (GraphQLNonNull (EnumType ))
223
+ _assert_input_type (GraphQLNonNull (InputObjectType ))
224
+
225
+ def _assert_non_input_type (type_ ):
226
+ assert is_input_type (type_ ) is False
219
227
with raises (TypeError ):
220
- assert_input_type (ObjectType )
228
+ assert_input_type (type_ )
229
+
230
+ def returns_false_for_an_output_type ():
231
+ _assert_non_input_type (ObjectType )
232
+ _assert_non_input_type (InterfaceType )
233
+ _assert_non_input_type (UnionType )
221
234
222
235
def returns_false_for_a_wrapped_output_type ():
223
- assert is_input_type (GraphQLList (ObjectType )) is False
224
- with raises (TypeError ):
225
- assert_input_type (GraphQLList (ObjectType ))
226
- assert is_input_type (GraphQLNonNull (ObjectType )) is False
227
- with raises (TypeError ):
228
- assert_input_type (GraphQLNonNull (ObjectType ))
236
+ _assert_non_input_type (GraphQLList (ObjectType ))
237
+ _assert_non_input_type (GraphQLList (InterfaceType ))
238
+ _assert_non_input_type (GraphQLList (UnionType ))
239
+
240
+ _assert_non_input_type (GraphQLNonNull (ObjectType ))
241
+ _assert_non_input_type (GraphQLNonNull (InterfaceType ))
242
+ _assert_non_input_type (GraphQLNonNull (UnionType ))
229
243
230
244
def describe_is_output_type ():
245
+ def _assert_output_type (type_ ):
246
+ assert is_output_type (type_ ) is True
247
+ assert_output_type (type_ )
248
+
231
249
def returns_true_for_an_output_type ():
232
- assert is_output_type (ObjectType ) is True
233
- assert_output_type (ObjectType )
250
+ _assert_output_type (GraphQLString )
251
+ _assert_output_type (ObjectType )
252
+ _assert_output_type (InterfaceType )
253
+ _assert_output_type (UnionType )
254
+ _assert_output_type (EnumType )
234
255
235
256
def returns_true_for_a_wrapped_output_type ():
236
- assert is_output_type (GraphQLList (ObjectType )) is True
237
- assert_output_type (GraphQLList (ObjectType ))
238
- assert is_output_type (GraphQLNonNull (ObjectType )) is True
239
- assert_output_type (GraphQLNonNull (ObjectType ))
257
+ _assert_output_type (GraphQLList (GraphQLString ))
258
+ _assert_output_type (GraphQLList (ObjectType ))
259
+ _assert_output_type (GraphQLList (InterfaceType ))
260
+ _assert_output_type (GraphQLList (UnionType ))
261
+ _assert_output_type (GraphQLList (EnumType ))
240
262
241
- def returns_false_for_an_input_type ():
242
- assert is_output_type (InputObjectType ) is False
263
+ _assert_output_type (GraphQLNonNull (GraphQLString ))
264
+ _assert_output_type (GraphQLNonNull (ObjectType ))
265
+ _assert_output_type (GraphQLNonNull (InterfaceType ))
266
+ _assert_output_type (GraphQLNonNull (UnionType ))
267
+ _assert_output_type (GraphQLNonNull (EnumType ))
268
+
269
+ def _assert_non_output_type (type_ ):
270
+ assert is_output_type (type_ ) is False
243
271
with raises (TypeError ):
244
- assert_output_type (InputObjectType )
272
+ assert_output_type (type_ )
273
+
274
+ def returns_false_for_an_input_type ():
275
+ _assert_non_output_type (InputObjectType )
245
276
246
277
def returns_false_for_a_wrapped_input_type ():
247
- assert is_output_type (GraphQLList (InputObjectType )) is False
248
- with raises (TypeError ):
249
- assert_output_type (GraphQLList (InputObjectType ))
250
- assert is_output_type (GraphQLNonNull (InputObjectType )) is False
251
- with raises (TypeError ):
252
- assert_output_type (GraphQLNonNull (InputObjectType ))
278
+ _assert_non_output_type (GraphQLList (InputObjectType ))
279
+ _assert_non_output_type (GraphQLNonNull (InputObjectType ))
253
280
254
281
def describe_is_leaf_type ():
255
282
def returns_true_for_scalar_and_enum_types ():
0 commit comments