This commit is contained in:
allen-munsch 2022-10-24 11:22:41 -05:00
parent c37b9f85bb
commit 990c4c4e9d
No known key found for this signature in database
GPG Key ID: 0C977048B8BDD447
2 changed files with 5 additions and 2 deletions

View File

@ -453,7 +453,7 @@ class Schema:
return _type return _type
def get_type(self, name): def get_type(self, name):
return self.graphql_schema.type_map.get(name).graphene_type return self.graphql_schema.type_map.get(name)
def lazy(self, _type): def lazy(self, _type):
return lambda: self.get_type(_type) return lambda: self.get_type(_type)

View File

@ -32,7 +32,10 @@ def test_schema_get_type():
schema = Schema(Query) schema = Schema(Query)
assert schema.Query == Query assert schema.Query == Query
assert schema.MyOtherType == MyOtherType assert schema.MyOtherType == MyOtherType
assert schema.get_type("MyOtherType") == MyOtherType name = "MyOtherType"
assert isinstance(schema.get_type(name), GraphQLObjectType)
assert schema.get_type(name).name == name
assert schema.get_type(name).graphene_type == MyOtherType
def test_schema_get_type_error(): def test_schema_get_type_error():