#NEWLINE# def test_exception( self ) : #NEWLINE# #INDENT# from palladium.util import session_scope #NEWLINE# session = Mock ( ) #NEWLINE# with pytest . raises ( KeyError ) : #NEWLINE# #INDENT# with session_scope ( session ) : #NEWLINE# #INDENT# raise KeyError ( 'Error' ) #NEWLINE# #UNINDENT# #UNINDENT# assert ( session . commit . call_count == 0 ) #NEWLINE# assert ( session . rollback . call_count == 1 ) #NEWLINE# assert ( session . close . call_count == 1 )