def test_simple(self): obj_schema = s.Object( "Foo", "the foo description!", interfaces=[ s.TypeRef("Interface1", s.Kind.INTERFACE, None), s.TypeRef("BlaInterface", s.Kind.INTERFACE, None), ], input_fields=None, fields=[ s.Field( "blabla", type=s.TypeRef("String", s.Kind.SCALAR, None), args=[], desc="my description", is_deprecated=False, deprecation_reason=None, ) ], ) interfaces = { "Interface1": type("Interface1", (quiz.Interface, ), {"__module__": "foo"}), "BlaInterface": type("BlaInterface", (quiz.Interface, ), {"__module__": "foo"}), "Qux": type("Qux", (quiz.Interface, ), {"__module__": "foo"}), } created = s.object_as_type(obj_schema, interfaces, module="foo") assert issubclass(created, quiz.Object) assert created.__name__ == "Foo" assert created.__doc__ == "the foo description!" assert created.__module__ == "foo" assert issubclass(created, interfaces["Interface1"]) assert issubclass(created, interfaces["BlaInterface"])
def test_simple(self): interface_schema = s.Interface('Foo', 'my interface!', [ s.Field( 'blabla', type=s.TypeRef('String', s.Kind.SCALAR, None), args=[], desc='my description', is_deprecated=False, deprecation_reason=None, ), ]) created = s.interface_as_type(interface_schema, module='mymodule') assert isinstance(created, quiz.Interface) assert issubclass(created, quiz.types.Namespace) assert created.__name__ == 'Foo' assert created.__doc__ == 'my interface!' assert created.__module__ == 'mymodule'
def test_simple(self): interface_schema = s.Interface( "Foo", "my interface!", [ s.Field( "blabla", type=s.TypeRef("String", s.Kind.SCALAR, None), args=[], desc="my description", is_deprecated=False, deprecation_reason=None, ) ], ) created = s.interface_as_type(interface_schema, module="mymodule") assert isinstance(created, quiz.Interface) assert issubclass(created, quiz.types.Namespace) assert created.__name__ == "Foo" assert created.__doc__ == "my interface!" assert created.__module__ == "mymodule"
def test_simple(self): obj_schema = s.Object('Foo', 'the foo description!', interfaces=[ s.TypeRef('Interface1', s.Kind.INTERFACE, None), s.TypeRef('BlaInterface', s.Kind.INTERFACE, None), ], input_fields=None, fields=[ s.Field( 'blabla', type=s.TypeRef('String', s.Kind.SCALAR, None), args=[], desc='my description', is_deprecated=False, deprecation_reason=None, ), ]) interfaces = { 'Interface1': type('Interface1', (quiz.Interface, ), {'__module__': 'foo'}), 'BlaInterface': type('BlaInterface', (quiz.Interface, ), {'__module__': 'foo'}), 'Qux': type('Qux', (quiz.Interface, ), {'__module__': 'foo'}), } created = s.object_as_type(obj_schema, interfaces, module='foo') assert issubclass(created, quiz.Object) assert created.__name__ == 'Foo' assert created.__doc__ == 'the foo description!' assert created.__module__ == 'foo' assert issubclass(created, interfaces['Interface1']) assert issubclass(created, interfaces['BlaInterface'])