#NEWLINE# @ contextlib . contextmanager #NEWLINE# def assert_type_error( self , msg ) : #NEWLINE# #INDENT# with self . assertRaises ( TypeError ) as raises : #NEWLINE# #INDENT# ( yield ) #NEWLINE# #UNINDENT# if ( msg is not None ) : #NEWLINE# #INDENT# self . assertRegexpMatches ( str ( msg . exception ) , msg )