本文整理汇总了Python中tulip.unix_events._UnixWritePipeTransport函数的典型用法代码示例。如果您正苦于以下问题:Python _UnixWritePipeTransport函数的具体用法?Python _UnixWritePipeTransport怎么用?Python _UnixWritePipeTransport使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_UnixWritePipeTransport函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_write_eof_pending
def test_write_eof_pending(self, m_fcntl):
tr = unix_events._UnixWritePipeTransport(self.loop, self.pipe)
tr.register_protocol(self.protocol)
tr._buffer = [b'data']
tr.write_eof()
self.assertTrue(tr._closing)
self.assertFalse(self.protocol.connection_lost.called)
开发者ID:sah,项目名称:tulip,代码行数:7,代码来源:unix_events_test.py
示例2: test_ctor_with_waiter
def test_ctor_with_waiter(self):
fut = futures.Future(loop=self.loop)
tr = unix_events._UnixWritePipeTransport(
self.loop, self.pipe, self.protocol, fut)
self.loop.assert_reader(5, tr._read_ready)
test_utils.run_briefly(self.loop)
self.assertEqual(None, fut.result())
开发者ID:nerodong,项目名称:tulip,代码行数:7,代码来源:unix_events_test.py
示例3: test_pause_resume_writing
def test_pause_resume_writing(self):
tr = unix_events._UnixWritePipeTransport(
self.loop, self.pipe, self.protocol)
tr.pause_writing()
self.assertFalse(tr._writing)
tr.resume_writing()
self.assertTrue(tr._writing)
开发者ID:concordusapps,项目名称:tulip,代码行数:7,代码来源:unix_events_test.py
示例4: test_write_eof
def test_write_eof(self, m_fcntl):
tr = unix_events._UnixWritePipeTransport(self.loop, self.pipe)
tr.write_eof()
self.assertTrue(tr._closing)
self.loop.call_soon.assert_called_with(
tr._call_connection_lost, None)
开发者ID:sah,项目名称:tulip,代码行数:7,代码来源:unix_events_test.py
示例5: test_close
def test_close(self):
tr = unix_events._UnixWritePipeTransport(
self.loop, self.pipe, self.protocol)
tr.write_eof = unittest.mock.Mock()
tr.close()
tr.write_eof.assert_called_with()
开发者ID:concordusapps,项目名称:tulip,代码行数:7,代码来源:unix_events_test.py
示例6: test_discard_output_without_pending_writes
def test_discard_output_without_pending_writes(self):
tr = unix_events._UnixWritePipeTransport(
self.loop, self.pipe, self.protocol)
tr.discard_output()
self.assertTrue(tr._writing)
self.assertFalse(self.loop.remove_writer.called)
self.assertEqual([], tr._buffer)
开发者ID:concordusapps,项目名称:tulip,代码行数:7,代码来源:unix_events_test.py
示例7: test_close_closing
def test_close_closing(self, m_fcntl):
tr = unix_events._UnixWritePipeTransport(self.loop, self.pipe)
tr.write_eof = unittest.mock.Mock()
tr._closing = True
tr.close()
self.assertFalse(tr.write_eof.called)
开发者ID:sah,项目名称:tulip,代码行数:7,代码来源:unix_events_test.py
示例8: test_ctor
def test_ctor(self):
tr = unix_events._UnixWritePipeTransport(
self.loop, self.pipe, self.protocol)
self.loop.add_reader.assert_called_with(5, tr._read_ready)
self.loop.call_soon.assert_called_with(
self.protocol.connection_made, tr)
self.assertTrue(tr._enable_read_hack)
开发者ID:concordusapps,项目名称:tulip,代码行数:7,代码来源:unix_events_test.py
示例9: test_write_no_data
def test_write_no_data(self, m_fcntl, m_write):
tr = unix_events._UnixWritePipeTransport(self.loop, self.pipe)
tr.write(b'')
self.assertFalse(m_write.called)
self.assertFalse(self.loop.add_writer.called)
self.assertEqual([], tr._buffer)
开发者ID:sah,项目名称:tulip,代码行数:7,代码来源:unix_events_test.py
示例10: test__call_connection_lost
def test__call_connection_lost(self):
tr = unix_events._UnixWritePipeTransport(
self.loop, self.pipe, self.protocol)
err = None
tr._call_connection_lost(err)
self.protocol.connection_lost.assert_called_with(err)
self.pipe.close.assert_called_with()
开发者ID:concordusapps,项目名称:tulip,代码行数:8,代码来源:unix_events_test.py
示例11: test_ctor_with_waiter
def test_ctor_with_waiter(self):
fut = futures.Future(loop=self.loop)
tr = unix_events._UnixWritePipeTransport(
self.loop, self.pipe, self.protocol, fut)
self.loop.call_soon.assert_called_with(fut.set_result, None)
self.loop.add_reader.assert_called_with(5, tr._read_ready)
self.assertTrue(tr._enable_read_hack)
fut.cancel()
开发者ID:concordusapps,项目名称:tulip,代码行数:8,代码来源:unix_events_test.py
示例12: test__call_connection_lost_with_err
def test__call_connection_lost_with_err(self, m_fcntl):
tr = unix_events._UnixWritePipeTransport(self.loop, self.pipe)
tr.register_protocol(self.protocol)
err = OSError()
tr._call_connection_lost(err)
self.protocol.connection_lost.assert_called_with(err)
self.pipe.close.assert_called_with()
开发者ID:sah,项目名称:tulip,代码行数:8,代码来源:unix_events_test.py
示例13: test_discard_output
def test_discard_output(self):
tr = unix_events._UnixWritePipeTransport(
self.loop, self.pipe, self.protocol)
tr._buffer = [b'da', b'ta']
tr.discard_output()
self.assertTrue(tr._writing)
self.loop.remove_writer.assert_called_with(5)
self.assertEqual([], tr._buffer)
开发者ID:concordusapps,项目名称:tulip,代码行数:8,代码来源:unix_events_test.py
示例14: test_ctor_with_regular_file
def test_ctor_with_regular_file(self):
with tempfile.TemporaryFile() as f:
tr = unix_events._UnixWritePipeTransport(self.loop, f,
self.protocol)
self.assertFalse(self.loop.add_reader.called)
self.loop.call_soon.assert_called_with(
self.protocol.connection_made, tr)
self.assertFalse(tr._enable_read_hack)
开发者ID:concordusapps,项目名称:tulip,代码行数:8,代码来源:unix_events_test.py
示例15: test_write_again
def test_write_again(self, m_fcntl, m_write):
tr = unix_events._UnixWritePipeTransport(self.loop, self.pipe)
m_write.side_effect = BlockingIOError()
tr.write(b'data')
m_write.assert_called_with(5, b'data')
self.loop.add_writer.assert_called_with(5, tr._write_ready)
self.assertEqual([b'data'], tr._buffer)
开发者ID:sah,项目名称:tulip,代码行数:8,代码来源:unix_events_test.py
示例16: test__write_ready
def test__write_ready(self, m_fcntl, m_write):
tr = unix_events._UnixWritePipeTransport(self.loop, self.pipe)
tr._buffer = [b'da', b'ta']
m_write.return_value = 4
tr._write_ready()
m_write.assert_called_with(5, b'data')
self.loop.remove_writer.assert_called_with(5)
self.assertEqual([], tr._buffer)
开发者ID:sah,项目名称:tulip,代码行数:8,代码来源:unix_events_test.py
示例17: test_write_partial
def test_write_partial(self, m_fcntl, m_write):
tr = unix_events._UnixWritePipeTransport(self.loop, self.pipe)
m_write.return_value = 2
tr.write(b'data')
m_write.assert_called_with(5, b'data')
self.loop.add_writer.assert_called_with(5, tr._write_ready)
self.assertEqual([b'ta'], tr._buffer)
开发者ID:sah,项目名称:tulip,代码行数:8,代码来源:unix_events_test.py
示例18: test_write_buffer
def test_write_buffer(self, m_fcntl, m_write):
tr = unix_events._UnixWritePipeTransport(self.loop, self.pipe)
tr._buffer = [b'previous']
tr.write(b'data')
self.assertFalse(m_write.called)
self.assertFalse(self.loop.add_writer.called)
self.assertEqual([b'previous', b'data'], tr._buffer)
开发者ID:sah,项目名称:tulip,代码行数:8,代码来源:unix_events_test.py
示例19: test_write
def test_write(self, m_fcntl, m_write):
tr = unix_events._UnixWritePipeTransport(self.loop, self.pipe)
m_write.return_value = 4
tr.write(b'data')
m_write.assert_called_with(5, b'data')
self.assertFalse(self.loop.add_writer.called)
self.assertEqual([], tr._buffer)
开发者ID:sah,项目名称:tulip,代码行数:8,代码来源:unix_events_test.py
示例20: test__write_ready_again
def test__write_ready_again(self, m_fcntl, m_write):
tr = unix_events._UnixWritePipeTransport(self.loop, self.pipe)
tr._buffer = [b'da', b'ta']
m_write.side_effect = BlockingIOError()
tr._write_ready()
m_write.assert_called_with(5, b'data')
self.assertFalse(self.loop.remove_writer.called)
self.assertEqual([b'data'], tr._buffer)
开发者ID:sah,项目名称:tulip,代码行数:9,代码来源:unix_events_test.py
注:本文中的tulip.unix_events._UnixWritePipeTransport函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论