File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 4
4
from ..interface import Interface
5
5
from ..objecttype import ObjectType
6
6
from ..unmountedtype import UnmountedType
7
+ from ..structures import NonNull
7
8
8
9
9
10
class MyType (Interface ):
@@ -56,6 +57,20 @@ class Meta:
56
57
assert MyObjectType ._meta .interfaces == (MyType , )
57
58
58
59
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
+
59
74
def test_generate_objecttype_with_fields ():
60
75
class MyObjectType (ObjectType ):
61
76
field = Field (MyType )
You can’t perform that action at this time.
0 commit comments