<s> import graphene <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 ( graphene . Mutation ) : <EOL> '''<STR_LIT>''' <EOL> class Input : <EOL> to = graphene . Int ( ) <EOL> result = graphene . String ( ) <EOL> @ classmethod <EOL> def mutate ( cls , instance , args , info ) : <EOL> global my_id <EOL> my_id = args . 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_input ( ) : <EOL> assert list ( schema . T ( ChangeNumber . arguments ) . keys ( ) ) == [ '<STR_LIT:to>' ] <EOL> def test_execute_mutations ( ) : <EOL> query = '''<STR_LIT>''' <EOL> expected = { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:result>' : '<STR_LIT:1>' , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:result>' : '<STR_LIT:2>' , <EOL> } , <EOL> '<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>
