def test_write_eof_write_pipe(self):
     tr = _ProactorWritePipeTransport(self.loop, self.sock, self.protocol)
     self.assertTrue(tr.can_write_eof())
     tr.write_eof()
     self.assertTrue(tr._closing)
     self.loop._run_once()
     self.assertTrue(self.sock.close.called)
     tr.close()
 def test_write_eof_write_pipe(self):
     tr = _ProactorWritePipeTransport(
         self.loop, self.sock, self.protocol)
     self.assertTrue(tr.can_write_eof())
     tr.write_eof()
     self.assertTrue(tr._closing)
     self.loop._run_once()
     self.assertTrue(self.sock.close.called)
     tr.close()
 def test_write_eof_buffer_write_pipe(self):
     tr = _ProactorWritePipeTransport(self.loop, self.sock, self.protocol)
     f = tulip.Future(loop=self.loop)
     tr._loop._proactor.send.return_value = f
     tr.write(b'data')
     tr.write_eof()
     self.assertTrue(tr._closing)
     self.assertFalse(self.sock.shutdown.called)
     tr._loop._proactor.send.assert_called_with(self.sock, b'data')
     f.set_result(4)
     self.loop._run_once()
     self.loop._run_once()
     self.assertTrue(self.sock.close.called)
     tr.close()
 def test_write_eof_buffer_write_pipe(self):
     tr = _ProactorWritePipeTransport(self.loop, self.sock, self.protocol)
     f = tulip.Future(loop=self.loop)
     tr._loop._proactor.send.return_value = f
     tr.write(b'data')
     tr.write_eof()
     self.assertTrue(tr._closing)
     self.assertFalse(self.sock.shutdown.called)
     tr._loop._proactor.send.assert_called_with(self.sock, b'data')
     f.set_result(4)
     self.loop._run_once()
     self.loop._run_once()
     self.assertTrue(self.sock.close.called)
     tr.close()