def implementation_is_subtype_of_interface():
     iface = GraphQLInterfaceType(
         'Interface', {'field': GraphQLField(GraphQLString)})
     impl = GraphQLObjectType(
         'Object',
         fields={'field': GraphQLField(GraphQLString)},
         interfaces=[iface])
     schema = test_schema(impl)
     assert is_type_sub_type_of(schema, impl, iface)
예제 #2
0
 def implementation_is_subtype_of_interface():
     iface = GraphQLInterfaceType(
         "Interface", {"field": GraphQLField(GraphQLString)})
     impl = GraphQLObjectType(
         "Object",
         fields={"field": GraphQLField(GraphQLString)},
         interfaces=[iface],
     )
     schema = _test_schema(impl)
     assert is_type_sub_type_of(schema, impl, iface)
예제 #3
0
 def implementing_interface_is_subtype_of_interface():
     iface = GraphQLInterfaceType(
         "Interface", {"field": GraphQLField(GraphQLString)})
     iface2 = GraphQLInterfaceType(
         "Interface2", {"field": GraphQLField(GraphQLString)}, [iface])
     impl = GraphQLObjectType(
         "Object",
         {"field": GraphQLField(GraphQLString)},
         [iface2, iface],
     )
     schema = _test_schema(impl)
     assert is_type_sub_type_of(schema, iface2, iface)
예제 #4
0
 def member_is_subtype_of_union():
     member = GraphQLObjectType("Object",
                                {"field": GraphQLField(GraphQLString)})
     union = GraphQLUnionType("Union", [member])
     schema = _test_schema(union)
     assert is_type_sub_type_of(schema, member, union)
예제 #5
0
 def list_is_not_subtype_of_item():
     assert not is_type_sub_type_of(_test_schema(),
                                    GraphQLList(GraphQLInt), GraphQLInt)
예제 #6
0
 def item_is_not_subtype_of_list():
     assert not is_type_sub_type_of(_test_schema(), GraphQLInt,
                                    GraphQLList(GraphQLInt))
예제 #7
0
 def nullable_is_not_subtype_of_non_null():
     assert (is_type_sub_type_of(_test_schema(), GraphQLInt,
                                 GraphQLNonNull(GraphQLInt)) is False)
예제 #8
0
 def non_null_is_subtype_of_nullable():
     assert (is_type_sub_type_of(_test_schema(),
                                 GraphQLNonNull(GraphQLInt), GraphQLInt)
             is True)
예제 #9
0
 def int_is_not_subtype_of_float():
     assert (is_type_sub_type_of(_test_schema(), GraphQLInt,
                                 GraphQLFloat) is False)
예제 #10
0
 def same_reference_is_subtype():
     assert (is_type_sub_type_of(_test_schema(), GraphQLString,
                                 GraphQLString) is True)
 def member_is_subtype_of_union():
     member = GraphQLObjectType('Object',
                                {'field': GraphQLField(GraphQLString)})
     union = GraphQLUnionType('Union', [member])
     schema = test_schema(union)
     assert is_type_sub_type_of(schema, member, union)