#NEWLINE# def test_synchronous_executor_doesnt_support_defers( ) : #NEWLINE# #INDENT# class Data ( object ) : #NEWLINE# #INDENT# def promise( self ) : #NEWLINE# #INDENT# return succeed ( "i shouldn'nt work" ) #NEWLINE# #UNINDENT# def notPromise( self ) : #NEWLINE# #INDENT# return 'i should work' #NEWLINE# #UNINDENT# #UNINDENT# DataType = GraphQLObjectType ( 'DataType' , { #NEWLINE# #INDENT# 'promise' : GraphQLField ( GraphQLNonNull ( GraphQLString ) ) , #NEWLINE# 'notPromise' : GraphQLField ( GraphQLString ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# doc = '\n    query Example {\n        promise\n        notPromise\n    }\n    ' #NEWLINE# schema = GraphQLSchema ( query = DataType ) #NEWLINE# executor = Executor ( [ SynchronousExecutionMiddleware ( ) ] ) #NEWLINE# result = executor . execute ( schema , doc , Data ( ) , operation_name = 'Example' ) #NEWLINE# assert ( not isinstance ( result , Deferred ) ) #NEWLINE# assert ( result . data is None ) #NEWLINE# formatted_errors = list ( map ( format_error , result . errors ) ) #NEWLINE# assert ( formatted_errors == [ { #NEWLINE# #INDENT# 'locations' : [ dict ( line = 3 , column = 9 ) ] , #NEWLINE# 'message' : 'You cannot return a Deferred from a resolver when using SynchronousExecutionMiddleware' , #NEWLINE# #UNINDENT# } ] )