#NEWLINE# def test_run_exception_in_interrupted_event_is_caught( run ) : #NEWLINE# #INDENT# observer = run . observers [ 0 ] #NEWLINE# observer2 = mock . Mock ( ) #NEWLINE# run . observers . append ( observer2 ) #NEWLINE# observer . interrupted_event . side_effect = TypeError #NEWLINE# run . main_function = mock . Mock ( side_effect = KeyboardInterrupt ) #NEWLINE# with pytest . raises ( KeyboardInterrupt ) : #NEWLINE# #INDENT# run ( ) #NEWLINE# #UNINDENT# assert observer . interrupted_event . called #NEWLINE# assert observer2 . interrupted_event . called