#NEWLINE# def assert_raises_message( except_cls , msg , callable_ , * args , **kwargs ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# callable_ ( * except_cls , ** kwargs ) #NEWLINE# assert False , 'Callable did not raise an exception' #NEWLINE# #UNINDENT# except except_cls as e : #NEWLINE# #INDENT# assert re . search ( msg , util . text_type ( e ) , re . UNICODE ) , ( '%r !~ %s' % ( msg , e ) ) #NEWLINE# print ( util . text_type ( e ) . encode ( 'utf-8' ) )