#NEWLINE# def test_nest_call( self ) : #NEWLINE# #INDENT# def a_func( **kwargs ) : #NEWLINE# #INDENT# kwargs [ 'list' ] . append ( 'here' ) #NEWLINE# return kwargs [ 'list' ] #NEWLINE# #UNINDENT# @ contextmanager #NEWLINE# def ctx_a( func , * args , **kwargs ) : #NEWLINE# #INDENT# eq_ ( func , a_func ) #NEWLINE# kwargs [ 'list' ] . append ( 0 ) #NEWLINE# ( yield ) #NEWLINE# kwargs [ 'list' ] . append ( 1 ) #NEWLINE# #UNINDENT# @ contextmanager #NEWLINE# def ctx_b( func , * args , **kwargs ) : #NEWLINE# #INDENT# eq_ ( func , a_func ) #NEWLINE# kwargs [ 'list' ] . append ( 2 ) #NEWLINE# ( yield ) #NEWLINE# kwargs [ 'list' ] . append ( 3 ) #NEWLINE# #UNINDENT# lst = [ ] #NEWLINE# kwargs = dict ( list = lst ) #NEWLINE# result = self . _call_with_contexts ( [ ctx_a , result ] , a_func , kwargs ) #NEWLINE# eq_ ( [ 0 , 2 , 'here' , 3 , 1 ] , result )