Ejemplo n.º 1
0
def function1790():
    with mock.patch('aiohttp.helpers.asyncio') as var1540:
        var1540.TimeoutError = asyncio.TimeoutError
        var3747 = mock.Mock()
        var2743 = helpers.TimerContext(var3747)
        var2743.timeout()
        with pytest.raises(asyncio.TimeoutError):
            with ctx:
                pass
        assert var1540.Task.current_task.return_value.cancel.called
Ejemplo n.º 2
0
def test_timer_context_cancelled() -> None:
    with mock.patch("aiohttp.helpers.asyncio") as m_asyncio:
        m_asyncio.TimeoutError = asyncio.TimeoutError
        loop = mock.Mock()
        ctx = helpers.TimerContext(loop)
        ctx.timeout()

        with pytest.raises(asyncio.TimeoutError):
            with ctx:
                pass

        assert m_asyncio.current_task.return_value.cancel.called
Ejemplo n.º 3
0
def test_timer_context_no_task(loop) -> None:
    with pytest.raises(RuntimeError):
        with helpers.TimerContext(loop):
            pass
Ejemplo n.º 4
0
def function2108(arg1342):
    with pytest.raises(RuntimeError):
        with helpers.TimerContext(arg1342):
            pass