#NEWLINE# @ contextlib . contextmanager #NEWLINE# def raises_str( klass , string ) : #NEWLINE# #INDENT# with pytest . raises ( klass ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# ( yield ) #NEWLINE# #UNINDENT# except klass as e : #NEWLINE# #INDENT# assert ( string in str ( e ) ) #NEWLINE# raise