示例#1
0
    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
示例#2
0
    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
示例#3
0
    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
示例#4
0
    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
示例#5
0
    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