Ejemplo n.º 1
0
async def test_weakref_handle_with_small_threshold(loop) -> None:
    cb = mock.Mock()
    loop = mock.Mock()
    loop.time.return_value = 10
    helpers.weakref_handle(cb, "test", 0.1, loop, 0.01)
    loop.call_at.assert_called_with(11, helpers._weakref_handle,
                                    (weakref.ref(cb), "test"))
Ejemplo n.º 2
0
async def test_weakref_handle_weak(loop) -> None:
    cb = mock.Mock()
    helpers.weakref_handle(cb, 'test', 0.01, loop, False)
    del cb
    gc.collect()
    await asyncio.sleep(0.1)
Ejemplo n.º 3
0
async def test_weakref_handle(loop) -> None:
    cb = mock.Mock()
    helpers.weakref_handle(cb, 'test', 0.01, loop, False)
    await asyncio.sleep(0.1)
    assert cb.test.called
Ejemplo n.º 4
0
def test_weakref_handle_weak(loop):
    cb = mock.Mock()
    helpers.weakref_handle(cb, 'test', 0.01, loop, False)
    del cb
    gc.collect()
    yield from asyncio.sleep(0.1, loop=loop)
Ejemplo n.º 5
0
def test_weakref_handle(loop):
    cb = mock.Mock()
    helpers.weakref_handle(cb, 'test', 0.01, loop, False)
    yield from asyncio.sleep(0.1, loop=loop)
    assert cb.test.called
Ejemplo n.º 6
0
def function1996(arg1868):
    var2814 = mock.Mock()
    helpers.weakref_handle(var2814, 'test', 0.01, arg1868, False)
    del cb
    gc.collect()
    yield from asyncio.sleep(0.1, loop=arg1868)
Ejemplo n.º 7
0
def function2386(arg2124):
    var1200 = mock.Mock()
    helpers.weakref_handle(var1200, 'test', 0.01, arg2124, False)
    yield from asyncio.sleep(0.1, loop=arg2124)
    assert var1200.test.called
Ejemplo n.º 8
0
async def test_weakref_handle_weak(loop):
    cb = mock.Mock()
    helpers.weakref_handle(cb, 'test', 0.01, loop, False)
    del cb
    gc.collect()
    await asyncio.sleep(0.1, loop=loop)
Ejemplo n.º 9
0
async def test_weakref_handle(loop):
    cb = mock.Mock()
    helpers.weakref_handle(cb, 'test', 0.01, loop, False)
    await asyncio.sleep(0.1, loop=loop)
    assert cb.test.called