#NEWLINE# def __check_result( self , result , **expecting_values ) : #NEWLINE# #INDENT# for key in ( 'nModified' , 'nUpserted' , 'nMatched' , 'writeErrors' , 'upserted' , 'writeConcernErrors' , 'nRemoved' , 'nInserted' ) : #NEWLINE# #INDENT# exp_val = expecting_values . get ( key ) #NEWLINE# has_val = result . get ( key ) #NEWLINE# if ( self . test_with_pymongo and ( key == 'nModified' ) and ( has_val is None ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# self . assertFalse ( ( has_val is None ) , ( "Missed key '%s' in result: %s" % ( key , result ) ) ) #NEWLINE# if exp_val : #NEWLINE# #INDENT# self . assertEqual ( exp_val , has_val , ( 'Invalid result %s=%s (but expected value=%s)' % ( key , has_val , exp_val ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . assertFalse ( bool ( has_val ) , ( 'Received unexpected value %s = %s' % ( key , has_val ) ) )