@@ -79,25 +79,9 @@ def test_object_type():
7979
8080
8181# Test Custom SQLAlchemyObjectType Implementation
82- class CustomSQLAlchemyObjectType (six .with_metaclass (SQLAlchemyObjectTypeMeta , ObjectType )):
83- @classmethod
84- def is_type_of (cls , root , context , info ):
85- return SQLAlchemyObjectType .is_type_of (root , context , info )
86-
87- @classmethod
88- def get_query (cls , context ):
89- return SQLAlchemyObjectType .get_query (context )
90-
91- @classmethod
92- def get_node (cls , id , context , info ):
93- return SQLAlchemyObjectType .get_node (id , context , info )
94-
95- @classmethod
96- def resolve_id (self , args , context , info ):
97- graphene_type = info .parent_type .graphene_type
98- if is_node (graphene_type ):
99- return self .__mapper__ .primary_key_from_instance (self )[0 ]
100- return getattr (self , graphene_type ._meta .id , None )
82+ class CustomSQLAlchemyObjectType (SQLAlchemyObjectType ):
83+ class Meta :
84+ abstract = True
10185
10286
10387class CustomCharacter (CustomSQLAlchemyObjectType ):
@@ -106,6 +90,7 @@ class Meta:
10690 model = Reporter
10791 registry = registry
10892
93+
10994def test_custom_objecttype_registered ():
11095 assert issubclass (CustomCharacter , ObjectType )
11196 assert CustomCharacter ._meta .model == Reporter
0 commit comments