def test_coroutine(self, fg): """ Incs and decs. """ f = aio.track_inprogress(fg)(coro) yield from f() assert 0 == fg._val assert 2 == fg._calls
def test_future(self, fg, event_loop): """ Incs and decs. """ fut = asyncio.Future(loop=event_loop) wrapped = aio.track_inprogress(fg, fut) assert 1 == fg._val fut.set_result(42) yield from wrapped assert 0 == fg._val
async def test_future(self, fg): """ Incs and decs. """ fut = asyncio.Future() wrapped = aio.track_inprogress(fg, fut) assert 1 == fg._val fut.set_result(42) await wrapped assert 0 == fg._val