diff --git a/graphene/types/tests/test_objecttype.py b/graphene/types/tests/test_objecttype.py index 5ff972de..9ad0f817 100644 --- a/graphene/types/tests/test_objecttype.py +++ b/graphene/types/tests/test_objecttype.py @@ -4,6 +4,7 @@ from ..field import Field from ..interface import Interface from ..objecttype import ObjectType from ..unmountedtype import UnmountedType +from ..structures import NonNull class MyType(Interface): @@ -56,6 +57,20 @@ def test_generate_objecttype_with_meta(): assert MyObjectType._meta.interfaces == (MyType, ) +def test_generate_lazy_objecttype(): + class MyObjectType(ObjectType): + example = Field(lambda: InnerObjectType, required=True) + + class InnerObjectType(ObjectType): + field = Field(MyType) + + + assert MyObjectType._meta.name == "MyObjectType" + example_field = MyObjectType._meta.fields['example'] + assert isinstance(example_field.type, NonNull) + assert example_field.type.of_type == InnerObjectType + + def test_generate_objecttype_with_fields(): class MyObjectType(ObjectType): field = Field(MyType)