#NEWLINE# def test_isolation_nonempty( self ) : #NEWLINE# #INDENT# def f1( ) : #NEWLINE# #INDENT# with StackContext ( functools . partial ( self . context , 'c1' ) ) : #NEWLINE# #INDENT# wrapped = wrap ( f2 ) #NEWLINE# #UNINDENT# with StackContext ( functools . partial ( self . context , 'c2' ) ) : #NEWLINE# #INDENT# wrapped ( ) #NEWLINE# #UNINDENT# #UNINDENT# def f2( ) : #NEWLINE# #INDENT# self . assertIn ( 'c1' , self . active_contexts ) #NEWLINE# self . io_loop . add_callback ( f3 ) #NEWLINE# #UNINDENT# def f3( ) : #NEWLINE# #INDENT# self . assertIn ( 'c1' , self . active_contexts ) #NEWLINE# self . assertNotIn ( 'c2' , self . active_contexts ) #NEWLINE# self . stop ( ) #NEWLINE# #UNINDENT# self . io_loop . add_callback ( f1 ) #NEWLINE# self . wait ( )