コード例 #1
0
def test_warn():
    with pytest.warns(DeprecationWarning) as ctx:
        helpers.deprecated_noop('Text')

    w = ctx.list[0]

    assert str(w.message) == 'Text'
    # Assert the warning points at us and not at _CoroGuard.
    assert w.filename == __file__
コード例 #2
0
ファイル: test_helpers.py プロジェクト: sunghyunzz/aiohttp
def test_warn():
    with pytest.warns(DeprecationWarning) as ctx:
        helpers.deprecated_noop('Text')

    w = ctx.list[0]

    assert str(w.message) == 'Text'
    # Assert the warning points at us and not at _CoroGuard.
    assert w.filename == __file__
コード例 #3
0
ファイル: myHttp.py プロジェクト: justdoitlee/python-learning
    def close(self):
        """
        对ClientSession类的close方法进行重写
        """
        if not self.closed:
            if self._connector_owner:
                self._connector.close()
            connector.append(self._connector)

        return deprecated_noop('ClientSession.close() is a coroutine')
コード例 #4
0
def test_no_warn_on_await():
    with pytest.warns(None) as ctx:
        yield from helpers.deprecated_noop('Text')
    assert not ctx.list
コード例 #5
0
ファイル: test_helpers.py プロジェクト: nagexiucai/aiohttp
def test_coro_guard_close():
    guard = helpers.deprecated_noop('Text')
    guard.close()
    assert not guard.gi_running
コード例 #6
0
ファイル: test_helpers.py プロジェクト: xs/aiohttp
def test_warn():
    with pytest.warns(DeprecationWarning) as ctx:
        helpers.deprecated_noop('Text')
    assert str(ctx.list[0].message) == 'Text'
コード例 #7
0
ファイル: test_helpers.py プロジェクト: grehujt/aiohttp
def test_no_warn_on_await():
    with pytest.warns(None) as ctx:
        yield from helpers.deprecated_noop('Text')
    assert not ctx.list
コード例 #8
0
ファイル: test_helpers.py プロジェクト: grehujt/aiohttp
def test_warn():
    with pytest.warns(DeprecationWarning) as ctx:
        helpers.deprecated_noop('Text')
    assert str(ctx.list[0].message) == 'Text'