Skip to content

Commit 4e6f665

Browse files
committed
Remove useless positive isTypeOf tests, since this function is optional
Replicates graphql/graphql-js@3caf46c
1 parent 52ec044 commit 4e6f665

File tree

2 files changed

+2
-43
lines changed

2 files changed

+2
-43
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ a query language for APIs created by Facebook.
1313
[![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
1414

1515
The current version 1.0.2 of GraphQL-core-next is up-to-date with GraphQL.js version
16-
14.1.1. All parts of the API are covered by an extensive test suite of currently 1728
16+
14.1.1. All parts of the API are covered by an extensive test suite of currently 1726
1717
unit tests.
1818

1919

tests/type/test_definition.py

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,6 @@ def schema_with_object_with_field_resolver(
5353
)
5454

5555

56-
ObjectWithIsTypeOf = GraphQLObjectType(
57-
"ObjectWithIsTypeOf", {"f": GraphQLField(GraphQLString)}
58-
)
59-
60-
6156
def describe_type_system_scalars():
6257
def accepts_a_scalar_type_defining_serialize():
6358
schema_with_field_type(GraphQLScalarType("SomeScalar", lambda: None))
@@ -266,11 +261,6 @@ def interfaces():
266261
def accepts_a_lambda_as_an_object_field_resolver():
267262
schema_with_object_with_field_resolver(lambda _obj, _info: {})
268263

269-
def accepts_an_object_type_with_an_is_type_of_function():
270-
schema_with_field_type(
271-
GraphQLObjectType("AnotherObject", {"f": GraphQLField(GraphQLString)})
272-
)
273-
274264
def rejects_an_object_type_field_with_undefined_config():
275265
undefined_field = cast(GraphQLField, None)
276266
obj_type = GraphQLObjectType("SomeObject", {"f": undefined_field})
@@ -394,30 +384,6 @@ def accepts_an_interface_type_defining_resolve_type():
394384
schema.query_type.fields["field"].type.interfaces[0] is AnotherInterfaceType
395385
)
396386

397-
def accepts_an_interface_with_implementing_type_defining_is_type_of():
398-
InterfaceTypeWithoutResolveType = GraphQLInterfaceType(
399-
"InterfaceTypeWithoutResolveType", {"f": GraphQLField(GraphQLString)}
400-
)
401-
402-
assert schema_with_field_type(
403-
GraphQLObjectType(
404-
"SomeObject",
405-
{"f": GraphQLField(GraphQLString)},
406-
[InterfaceTypeWithoutResolveType],
407-
)
408-
)
409-
410-
def accepts_interface_type_with_resolve_type_and_is_type_of_in_implementation():
411-
AnotherInterfaceType = GraphQLInterfaceType(
412-
"AnotherInterfaceType", {"f": GraphQLField(GraphQLString)}
413-
)
414-
415-
assert schema_with_field_type(
416-
GraphQLObjectType(
417-
"SomeObject", {"f": GraphQLField(GraphQLString)}, [AnotherInterfaceType]
418-
)
419-
)
420-
421387
def rejects_an_interface_type_with_an_incorrect_type_for_resolve_type():
422388
with raises(TypeError) as exc_info:
423389
# noinspection PyTypeChecker
@@ -442,11 +408,6 @@ def allows_a_thunk_for_union_member_types():
442408
def accepts_a_union_type_defining_resolve_type():
443409
assert schema_with_field_type(GraphQLUnionType("SomeUnion", [ObjectType]))
444410

445-
def accepts_a_union_of_object_types_defining_is_type_of():
446-
assert schema_with_field_type(
447-
GraphQLUnionType("SomeUnion", [ObjectWithIsTypeOf])
448-
)
449-
450411
def accepts_a_union_type_with_list_types():
451412
assert schema_with_field_type(GraphQLUnionType("SomeUnion", [ObjectType]))
452413

@@ -463,9 +424,7 @@ def accepts_a_union_type_without_types():
463424
def rejects_an_interface_type_with_an_incorrect_type_for_resolve_type():
464425
with raises(TypeError) as exc_info:
465426
# noinspection PyTypeChecker
466-
schema_with_field_type(
467-
GraphQLUnionType("SomeUnion", [ObjectWithIsTypeOf], resolve_type={})
468-
)
427+
schema_with_field_type(GraphQLUnionType("SomeUnion", [], resolve_type={}))
469428
msg = str(exc_info.value)
470429
assert msg == (
471430
"SomeUnion must provide 'resolve_type' as a function, but got: {}."

0 commit comments

Comments
 (0)