#NEWLINE# def testExitThrows( self ) : #NEWLINE# #INDENT# class ExitThrows ( object ) : #NEWLINE# #INDENT# def __enter__( self ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# def __exit__( self , * args ) : #NEWLINE# #INDENT# raise RuntimeError ( 42 ) #NEWLINE# #UNINDENT# #UNINDENT# def shouldThrow( ) : #NEWLINE# #INDENT# with ExitThrows ( ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# self . assertRaises ( RuntimeError , self )