本文整理汇总了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 )
示例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 )