#NEWLINE# @ testing . allow_interpreter_mode #NEWLINE# def test_del_ref_func( self ) : #NEWLINE# #INDENT# pyfunc = del_ref_func #NEWLINE# cr = compile_isolated ( pyfunc , ( ) ) #NEWLINE# cfunc = cr . entry_point #NEWLINE# errmsg = "local variable 'x' referenced before assignment" #NEWLINE# with self . assertRaises ( UnboundLocalError ) as raised : #NEWLINE# #INDENT# pyfunc ( 1 ) #NEWLINE# #UNINDENT# if ( re . search ( str ( raised . exception ) , errmsg ) is None ) : #NEWLINE# #INDENT# self . fail ( 'unexpected exception: {0}' . format ( raised . exception ) ) #NEWLINE# #UNINDENT# with self . assertRaises ( UnboundLocalError ) as raised : #NEWLINE# #INDENT# cfunc ( 1 ) #NEWLINE# #UNINDENT# if ( re . search ( str ( raised . exception ) , errmsg ) is None ) : #NEWLINE# #INDENT# self . fail ( 'unexpected exception: {0}' . format ( raised . exception ) )