本文整理汇总了Python中eventsocket.EventSocket.bind方法的典型用法代码示例。如果您正苦于以下问题:Python EventSocket.bind方法的具体用法?Python EventSocket.bind怎么用?Python EventSocket.bind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eventsocket.EventSocket
的用法示例。
在下文中一共展示了EventSocket.bind方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_bind_without_debugging
# 需要导入模块: from eventsocket import EventSocket [as 别名]
# 或者: from eventsocket.EventSocket import bind [as 别名]
def test_bind_without_debugging(self):
sock = EventSocket()
sock._sock = mock()
mock(sock, 'getsockname')
expect(sock._sock.bind).args( 'arg1', 'arg2' )
expect(sock.getsockname).returns( ('foo',1234) )
expect(eventsocket.event.read).args( sock, sock._protected_cb, sock._accept_cb )
sock.bind( 'arg1', 'arg2' )
示例2: test_bind_with_debugging
# 需要导入模块: from eventsocket import EventSocket [as 别名]
# 或者: from eventsocket.EventSocket import bind [as 别名]
def test_bind_with_debugging(self):
sock = EventSocket()
sock._sock = mock()
sock._debug = True
sock._logger = mock()
mock( sock, 'getsockname' )
expect(sock._logger.debug).args( "binding to %s", str(('arg1','arg2')) )
expect(sock._sock.bind).args( 'arg1', 'arg2' )
expect(sock.getsockname).returns( ('foo',1234) )
expect(eventsocket.event.read).args( sock, sock._protected_cb, sock._accept_cb ).returns('accept_event')
sock.bind( 'arg1', 'arg2' )
assert_equals( "foo:1234", sock._peername )
assert_equals( 'accept_event', sock._accept_event )