#NEWLINE# def __exit__( self , exc_type , exc_value , tb ) : #NEWLINE# #INDENT# if ( exc_type is None ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# exc_name = self . expected . __name__ #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# exc_name = str ( self . expected ) #NEWLINE# #UNINDENT# raise self . failureException ( '{0} not raised' . format ( exc_name ) ) #NEWLINE# #UNINDENT# if ( not issubclass ( exc_type , self . expected ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# self . exception = exc_value #NEWLINE# if ( self . expected_regexp is None ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# expected_regexp = self . expected_regexp #NEWLINE# if isinstance ( expected_regexp , basestring ) : #NEWLINE# #INDENT# expected_regexp = re . compile ( expected_regexp ) #NEWLINE# #UNINDENT# if ( not expected_regexp . search ( str ( exc_value ) ) ) : #NEWLINE# #INDENT# raise self . failureException ( ( '"%s" does not match "%s"' % ( exc_name . pattern , str ( exc_value ) ) ) ) #NEWLINE# #UNINDENT# return True