<s> from graphql . core . type import GraphQLInputObjectField <EOL> import graphene <EOL> from graphene import relay <EOL> from graphene . core . schema import Schema <EOL> my_id = <NUM_LIT:0> <EOL> class Query ( graphene . ObjectType ) : <EOL> base = graphene . String ( ) <EOL> class ChangeNumber ( relay . ClientIDMutation ) : <EOL> '''<STR_LIT>''' <EOL> class Input : <EOL> to = graphene . Int ( ) <EOL> result = graphene . String ( ) <EOL> @ classmethod <EOL> def mutate_and_get_payload ( cls , input , info ) : <EOL> global my_id <EOL> my_id = input . get ( '<STR_LIT:to>' , my_id + <NUM_LIT:1> ) <EOL> return ChangeNumber ( result = my_id ) <EOL> class MyResultMutation ( graphene . ObjectType ) : <EOL> change_number = graphene . Field ( ChangeNumber ) <EOL> schema = Schema ( query = Query , mutation = MyResultMutation ) <EOL> def test_mutation_arguments ( ) : <EOL> assert ChangeNumber . arguments <EOL> assert '<STR_LIT:input>' in schema . T ( ChangeNumber . arguments ) <EOL> inner_type = ChangeNumber . input_type <EOL> client_mutation_id_field = inner_type . _meta . fields_map [ <EOL> '<STR_LIT>' ] <EOL> assert issubclass ( inner_type , graphene . InputObjectType ) <EOL> assert isinstance ( client_mutation_id_field . type , graphene . NonNull ) <EOL> assert isinstance ( client_mutation_id_field . type . of_type , graphene . String ) <EOL> assert client_mutation_id_field . object_type == inner_type <EOL> assert isinstance ( schema . T ( client_mutation_id_field ) , GraphQLInputObjectField ) <EOL> def test_execute_mutations ( ) : <EOL> query = '''<STR_LIT>''' <EOL> expected = { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:result>' : '<STR_LIT:1>' , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:result>' : '<STR_LIT:2>' , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:result>' : '<STR_LIT:5>' , <EOL> } <EOL> } <EOL> result = schema . execute ( query , root = object ( ) ) <EOL> assert not result . errors <EOL> assert result . data == expected </s>
