#NEWLINE# def test_sendfile_raises_EPIPE( self ) : #NEWLINE# #INDENT# chunk = 'foo' #NEWLINE# args = ( chunk , None , None , False ) #NEWLINE# pants . _channel . sendfile = MagicMock ( side_effect = Exception ( errno . EPIPE ) ) #NEWLINE# self . channel . close = MagicMock ( ) #NEWLINE# result = self . channel . _socket_sendfile ( * args ) #NEWLINE# self . assertEqual ( result , 0 ) #NEWLINE# self . channel . close . assert_called_once_with ( flush = False )