@@ -39,15 +39,17 @@ def deprecation_reason(self):
39
39
assert graphql_enum .description == 'Description'
40
40
values = graphql_enum .values
41
41
assert values == [
42
- GraphQLEnumValue (name = 'foo' , value = 1 , description = 'Description foo=1' , deprecation_reason = 'Is deprecated' ),
42
+ GraphQLEnumValue (name = 'foo' , value = 1 , description = 'Description foo=1' ,
43
+ deprecation_reason = 'Is deprecated' ),
43
44
GraphQLEnumValue (name = 'bar' , value = 2 , description = 'Description bar=2' ),
44
45
]
45
46
46
47
47
48
def test_objecttype ():
48
49
class MyObjectType (ObjectType ):
49
50
'''Description'''
50
- foo = String (bar = String (description = 'Argument description' , default_value = 'x' ), description = 'Field description' )
51
+ foo = String (bar = String (description = 'Argument description' ,
52
+ default_value = 'x' ), description = 'Field description' )
51
53
bar = String (name = 'gizmo' )
52
54
53
55
def resolve_foo (self , bar ):
@@ -92,8 +94,10 @@ class MyObjectType(ObjectType):
92
94
def test_interface ():
93
95
class MyInterface (Interface ):
94
96
'''Description'''
95
- foo = String (bar = String (description = 'Argument description' , default_value = 'x' ), description = 'Field description' )
96
- bar = String (name = 'gizmo' , first_arg = String (), other_arg = String (name = 'oth_arg' ))
97
+ foo = String (bar = String (description = 'Argument description' ,
98
+ default_value = 'x' ), description = 'Field description' )
99
+ bar = String (name = 'gizmo' , first_arg = String (),
100
+ other_arg = String (name = 'oth_arg' ))
97
101
own = Field (lambda : MyInterface )
98
102
99
103
def resolve_foo (self , args , info ):
@@ -144,12 +148,16 @@ def resolve_foo_bar(self, args, info):
144
148
assert graphql_type .name == 'MyInputObjectType'
145
149
assert graphql_type .description == 'Description'
146
150
147
- # Container
151
+ other_graphql_type = typemap ['OtherObjectType' ]
152
+ inner_graphql_type = typemap ['MyInnerObjectType' ]
148
153
container = graphql_type .create_container ({
149
154
'bar' : 'oh!' ,
150
- 'baz' : {
151
- 'some_other_field' : [{'thingy' : 1 }, {'thingy' : 2 }]
152
- }
155
+ 'baz' : inner_graphql_type .create_container ({
156
+ 'some_other_field' : [
157
+ other_graphql_type .create_container ({'thingy' : 1 }),
158
+ other_graphql_type .create_container ({'thingy' : 2 })
159
+ ]
160
+ })
153
161
})
154
162
assert isinstance (container , MyInputObjectType )
155
163
assert 'bar' in container
0 commit comments