Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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