#NEWLINE# def test_failed_simple( self ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# self . client . pymongo_test . command ( 'oops!' ) #NEWLINE# #UNINDENT# except OperationFailure : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# results = self . listener . results #NEWLINE# started = results [ 'started' ] [ 0 ] #NEWLINE# failed = results [ 'failed' ] [ 0 ] #NEWLINE# self . assertEqual ( 0 , len ( results [ 'succeeded' ] ) ) #NEWLINE# self . assertTrue ( isinstance ( started , monitoring . CommandStartedEvent ) ) #NEWLINE# self . assertTrue ( isinstance ( failed , monitoring . CommandFailedEvent ) ) #NEWLINE# self . assertEqual ( 'oops!' , results . command_name ) #NEWLINE# self . assertEqual ( self . client . address , failed . connection_id ) #NEWLINE# self . assertEqual ( 0 , failed . failure . get ( 'ok' ) ) #NEWLINE# self . assertTrue ( isinstance ( failed . request_id , int ) ) #NEWLINE# self . assertTrue ( isinstance ( failed . duration_micros , int ) )