Skip to content

Commit 43cda1d

Browse files
committed
Added extra test to objecttypes
1 parent f79eb57 commit 43cda1d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

graphene/types/tests/test_objecttype.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from ..interface import Interface
55
from ..objecttype import ObjectType
66
from ..unmountedtype import UnmountedType
7+
from ..structures import NonNull
78

89

910
class MyType(Interface):
@@ -56,6 +57,20 @@ class Meta:
5657
assert MyObjectType._meta.interfaces == (MyType, )
5758

5859

60+
def test_generate_lazy_objecttype():
61+
class MyObjectType(ObjectType):
62+
example = Field(lambda: InnerObjectType, required=True)
63+
64+
class InnerObjectType(ObjectType):
65+
field = Field(MyType)
66+
67+
68+
assert MyObjectType._meta.name == "MyObjectType"
69+
example_field = MyObjectType._meta.fields['example']
70+
assert isinstance(example_field.type, NonNull)
71+
assert example_field.type.of_type == InnerObjectType
72+
73+
5974
def test_generate_objecttype_with_fields():
6075
class MyObjectType(ObjectType):
6176
field = Field(MyType)

0 commit comments

Comments
 (0)