#NEWLINE# def test_tap( self ) : #NEWLINE# #INDENT# ns = self . Namespace ( ) #NEWLINE# ns . intercepted = None #NEWLINE# def interceptor( obj ) : #NEWLINE# #INDENT# ns . intercepted = obj #NEWLINE# #UNINDENT# returned = _ . tap ( 1 , interceptor ) #NEWLINE# self . assertEqual ( ns . intercepted , 1 , 'passes tapped object to interceptor' ) #NEWLINE# self . assertEqual ( interceptor , 1 , 'returns tapped object' ) #NEWLINE# returned = _ ( [ 1 , 2 , 3 ] ) . chain ( ) . map ( ( lambda n , * args : ( n * 2 ) ) ) . max ( ) . tap ( interceptor ) . value ( ) #NEWLINE# self . assertTrue ( ( ( returned == 6 ) and ( ns . intercepted == 6 ) ) , 'can use tapped objects in a chain' )