#NEWLINE# @ mock . patch ( 'os.close' , ** PATCH_OPTS ) #NEWLINE# def test_close_fds( self , mock_close ) : #NEWLINE# #INDENT# mock_fd = mock . Mock ( ) #NEWLINE# mock_fd . fileno . side_effect = [ 0 , 1 , 2 ] #NEWLINE# with stdio_as ( mock_close , mock_fd , mock_fd ) : #NEWLINE# #INDENT# self . pantsd . _close_fds ( ) #NEWLINE# #UNINDENT# self . assertEquals ( mock_fd . close . call_count , 3 ) #NEWLINE# mock_close . assert_has_calls ( ( mock . call ( x ) for x in [ 0 , 1 , 2 ] ) )