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


Python Connection.close方法代码示例

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


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

示例1: test_close

# 需要导入模块: from aiohttp.connector import Connection [as 别名]
# 或者: from aiohttp.connector.Connection import close [as 别名]
 def test_close(self):
     conn = Connection(
         self.connector, self.key, self.request,
         self.transport, self.protocol)
     conn.close()
     self.assertTrue(self.transport.close.called)
     self.assertIsNone(conn._transport)
开发者ID:ealasu,项目名称:aiohttp,代码行数:9,代码来源:test_connector.py

示例2: test_ctor

# 需要导入模块: from aiohttp.connector import Connection [as 别名]
# 或者: from aiohttp.connector.Connection import close [as 别名]
def test_ctor(connector, key, request, transport, protocol, loop):
    conn = Connection(connector, key, request,
                      transport, protocol, loop)
    assert conn.loop is loop
    assert conn.protocol is protocol
    assert conn.writer is protocol.writer
    conn.close()
开发者ID:singulared,项目名称:aiohttp,代码行数:9,代码来源:test_client_connection.py

示例3: test_close

# 需要导入模块: from aiohttp.connector import Connection [as 别名]
# 或者: from aiohttp.connector.Connection import close [as 别名]
def test_close(connector, key, protocol, loop) -> None:
    conn = Connection(connector, key, protocol, loop)
    assert not conn.closed
    conn.close()
    assert conn._protocol is None
    connector._release.assert_called_with(key, protocol, should_close=True)
    assert conn.closed
开发者ID:KeepSafe,项目名称:aiohttp,代码行数:9,代码来源:test_client_connection.py

示例4: test_close

# 需要导入模块: from aiohttp.connector import Connection [as 别名]
# 或者: from aiohttp.connector.Connection import close [as 别名]
 def test_close(self):
     conn = Connection(
         self.connector, self.key, self.request,
         self.transport, self.protocol, self.loop)
     conn.close()
     self.assertIsNone(conn._transport)
     self.connector._release.assert_called_with(
         self.key, self.request, self.transport, self.protocol,
         should_close=True)
开发者ID:benjamin-bader,项目名称:aiohttp,代码行数:11,代码来源:test_connector.py

示例5: test_close

# 需要导入模块: from aiohttp.connector import Connection [as 别名]
# 或者: from aiohttp.connector.Connection import close [as 别名]
def test_close(connector, key, request, transport, protocol, loop):
    conn = Connection(connector, key, request,
                      transport, protocol, loop)
    assert not conn.closed
    conn.close()
    assert conn._transport is None
    connector._release.assert_called_with(
        key, request, transport, protocol,
        should_close=True)
    assert conn.closed
开发者ID:1st1,项目名称:aiohttp,代码行数:12,代码来源:test_client_connection.py

示例6: test_callbacks_on_close

# 需要导入模块: from aiohttp.connector import Connection [as 别名]
# 或者: from aiohttp.connector.Connection import close [as 别名]
def test_callbacks_on_close(connector, key, protocol, loop) -> None:
    conn = Connection(connector, key, protocol, loop)
    notified = False

    def cb():
        nonlocal notified
        notified = True

    conn.add_callback(cb)
    conn.close()
    assert notified
开发者ID:KeepSafe,项目名称:aiohttp,代码行数:13,代码来源:test_client_connection.py

示例7: test_callbacks_exception

# 需要导入模块: from aiohttp.connector import Connection [as 别名]
# 或者: from aiohttp.connector.Connection import close [as 别名]
def test_callbacks_exception(connector, key, protocol, loop) -> None:
    conn = Connection(connector, key, protocol, loop)
    notified = False

    def cb1():
        raise Exception

    def cb2():
        nonlocal notified
        notified = True

    conn.add_callback(cb1)
    conn.add_callback(cb2)
    conn.close()
    assert notified
开发者ID:KeepSafe,项目名称:aiohttp,代码行数:17,代码来源:test_client_connection.py

示例8: test_ctor

# 需要导入模块: from aiohttp.connector import Connection [as 别名]
# 或者: from aiohttp.connector.Connection import close [as 别名]
def test_ctor(connector, key, protocol, loop) -> None:
    conn = Connection(connector, key, protocol, loop)
    with pytest.warns(DeprecationWarning):
        assert conn.loop is loop
    assert conn.protocol is protocol
    conn.close()
开发者ID:KeepSafe,项目名称:aiohttp,代码行数:8,代码来源:test_client_connection.py

示例9: test_ctor

# 需要导入模块: from aiohttp.connector import Connection [as 别名]
# 或者: from aiohttp.connector.Connection import close [as 别名]
def test_ctor(connector, key, protocol, loop) -> None:
    conn = Connection(connector, key, protocol, loop)
    assert conn.loop is loop
    assert conn.protocol is protocol
    assert conn.writer is protocol.writer
    conn.close()
开发者ID:KazuCocoa,项目名称:aiohttp,代码行数:8,代码来源:test_client_connection.py


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