当前位置: 首页>>代码示例>>Python>>正文


Python EventSocket._write_event方法代码示例

本文整理汇总了Python中eventsocket.EventSocket._write_event方法的典型用法代码示例。如果您正苦于以下问题:Python EventSocket._write_event方法的具体用法?Python EventSocket._write_event怎么用?Python EventSocket._write_event使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eventsocket.EventSocket的用法示例。


在下文中一共展示了EventSocket._write_event方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_write_when_write_event_and_not_pending

# 需要导入模块: from eventsocket import EventSocket [as 别名]
# 或者: from eventsocket.EventSocket import _write_event [as 别名]
  def test_write_when_write_event_and_not_pending(self):
    sock = EventSocket()
    sock._write_event = mock()
    
    expect( sock._write_event.pending ).returns( False )
    expect( sock._write_event.add )
    expect( sock._flag_activity )

    sock.write( 'foo' )
    assert_equals( deque(['foo']), sock._write_buf )
开发者ID:agoragames,项目名称:py-eventsocket,代码行数:12,代码来源:evented_socket_test.py

示例2: test_write_when_write_event_is_pending_and_debugging

# 需要导入模块: from eventsocket import EventSocket [as 别名]
# 或者: from eventsocket.EventSocket import _write_event [as 别名]
  def test_write_when_write_event_is_pending_and_debugging(self):
    sock = EventSocket()
    sock._write_event = mock()
    sock._peername = 'peername'
    sock._write_buf = deque(['data'])
    sock._debug = 2
    sock._logger = mock()
    
    expect( sock._write_event.pending ).returns( True )
    expect( sock._logger.debug ).args(str, 3, 7, 'peername')
    expect( sock._flag_activity )

    sock.write( 'foo' )
    assert_equals( deque(['data', 'foo']), sock._write_buf )
开发者ID:agoragames,项目名称:py-eventsocket,代码行数:16,代码来源:evented_socket_test.py


注:本文中的eventsocket.EventSocket._write_event方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。