#NEWLINE# def test_catch_string( self ) : #NEWLINE# #INDENT# with warnings . catch_warnings ( ) : #NEWLINE# #INDENT# warnings . resetwarnings ( ) #NEWLINE# warnings . filterwarnings ( 'error' ) #NEWLINE# str_exc = 'spam' #NEWLINE# with self . assertRaises ( DeprecationWarning ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# raise StandardError #NEWLINE# #UNINDENT# except str_exc : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# with self . assertRaises ( DeprecationWarning ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# raise StandardError #NEWLINE# #UNINDENT# except ( AssertionError , str_exc ) : #NEWLINE# #INDENT# pass