@@ -154,11 +154,36 @@ def can_access_root_value():
154
154
)
155
155
156
156
def supports_mutations_returning_null ():
157
+ def null_resolve (_info , ** _input ) -> None :
158
+ return None
159
+
160
+ some_mutation = mutation_with_client_mutation_id (
161
+ "SomeMutation" , {}, {"result" : GraphQLField (GraphQLInt )}, null_resolve
162
+ )
163
+ schema = wrap_in_schema ({"someMutation" : some_mutation })
164
+ source = """
165
+ mutation {
166
+ someMutation(input: {clientMutationId: "abc"}) {
167
+ result
168
+ clientMutationId
169
+ }
170
+ }
171
+ """
172
+ assert graphql_sync (schema , source ) == (
173
+ {"someMutation" : {"result" : None , "clientMutationId" : "abc" }},
174
+ None ,
175
+ )
176
+
177
+ @mark .asyncio
178
+ async def supports_async_mutations_returning_null ():
179
+ async def null_resolve (_info , ** _input ) -> None :
180
+ return None
181
+
157
182
some_mutation = mutation_with_client_mutation_id (
158
183
"SomeMutation" ,
159
184
{},
160
185
{"result" : GraphQLField (GraphQLInt )},
161
- lambda _info , ** _input : None ,
186
+ null_resolve ,
162
187
)
163
188
schema = wrap_in_schema ({"someMutation" : some_mutation })
164
189
source = """
@@ -169,7 +194,7 @@ def supports_mutations_returning_null():
169
194
}
170
195
}
171
196
"""
172
- assert graphql_sync (schema , source ) == (
197
+ assert await graphql (schema , source ) == (
173
198
{"someMutation" : {"result" : None , "clientMutationId" : "abc" }},
174
199
None ,
175
200
)
0 commit comments