本文整理汇总了Python中aiohttp.connector.Connection.release方法的典型用法代码示例。如果您正苦于以下问题:Python Connection.release方法的具体用法?Python Connection.release怎么用?Python Connection.release使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aiohttp.connector.Connection
的用法示例。
在下文中一共展示了Connection.release方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_detach_closed
# 需要导入模块: from aiohttp.connector import Connection [as 别名]
# 或者: from aiohttp.connector.Connection import release [as 别名]
def test_detach_closed(connector, key, protocol, loop):
conn = Connection(connector, key, protocol, loop)
conn.release()
conn.detach()
assert not connector._release_acquired.called
assert conn._protocol is None
示例2: test_release_released
# 需要导入模块: from aiohttp.connector import Connection [as 别名]
# 或者: from aiohttp.connector.Connection import release [as 别名]
def test_release_released(connector, key, protocol, loop) -> None:
conn = Connection(connector, key, protocol, loop)
conn.release()
connector._release.reset_mock()
conn.release()
assert not protocol.transport.close.called
assert conn._protocol is None
assert not connector._release.called
示例3: test_release
# 需要导入模块: from aiohttp.connector import Connection [as 别名]
# 或者: from aiohttp.connector.Connection import release [as 别名]
def test_release(connector, key, protocol, loop) -> None:
conn = Connection(connector, key, protocol, loop)
assert not conn.closed
conn.release()
assert not protocol.transport.close.called
assert conn._protocol is None
connector._release.assert_called_with(key, protocol, should_close=False)
assert conn.closed
示例4: test_release_released
# 需要导入模块: from aiohttp.connector import Connection [as 别名]
# 或者: from aiohttp.connector.Connection import release [as 别名]
def test_release_released(connector, key, request, transport, protocol, loop):
conn = Connection(connector, key, request,
transport, protocol, loop)
conn.release()
connector._release.reset_mock()
conn.release()
assert not transport.close.called
assert conn._transport is None
assert not connector._release.called
示例5: test_release
# 需要导入模块: from aiohttp.connector import Connection [as 别名]
# 或者: from aiohttp.connector.Connection import release [as 别名]
def test_release(self):
conn = Connection(
self.connector, self.key, self.request,
self.transport, self.protocol)
conn.release()
self.assertFalse(self.transport.close.called)
self.assertIsNone(conn._transport)
self.connector._release.assert_called_with(
self.key, self.request, self.transport, self.protocol)
示例6: test_release_released
# 需要导入模块: from aiohttp.connector import Connection [as 别名]
# 或者: from aiohttp.connector.Connection import release [as 别名]
def test_release_released(self):
conn = Connection(
self.connector, self.key, self.request,
self.transport, self.protocol, self.loop)
conn.release()
self.connector._release.reset_mock()
conn.release()
self.assertFalse(self.transport.close.called)
self.assertIsNone(conn._transport)
self.assertFalse(self.connector._release.called)
示例7: test_release
# 需要导入模块: from aiohttp.connector import Connection [as 别名]
# 或者: from aiohttp.connector.Connection import release [as 别名]
def test_release(connector, key, request, transport, protocol, loop):
conn = Connection(connector, key, request,
transport, protocol, loop)
assert not conn.closed
conn.release()
assert not transport.close.called
assert conn._transport is None
connector._release.assert_called_with(
key, request, transport, protocol,
should_close=False)
assert conn.closed
示例8: test_callbacks_on_release
# 需要导入模块: from aiohttp.connector import Connection [as 别名]
# 或者: from aiohttp.connector.Connection import release [as 别名]
def test_callbacks_on_release(connector, key, protocol, loop) -> None:
conn = Connection(connector, key, protocol, loop)
notified = False
def cb():
nonlocal notified
notified = True
conn.add_callback(cb)
conn.release()
assert notified