Exemplo n.º 1
0
async def test_catch_one_with_error():
    xs = from_async_iterable(iter_error())
    result = []

    async def asend(value):
        log.debug("test_catch_one_with_error:asend(%s)", value)
        result.append(value)

    zs = catch_exception([xs])

    await run(zs, AsyncAnonymousObserver(asend))
    assert result == list(range(5))
Exemplo n.º 2
0
async def test_retry():
    xs = from_async_iterable(iter_error())
    result = []

    async def asend(value):
        print("ASEND", value)
        log.debug("test_retry:asend(%s)", value)
        result.append(value)

    zs = catch_exception([xs])

    await run(zs, AsyncAnonymousObserver(asend))
    assert result == list(range(10))
Exemplo n.º 3
0
async def test_catch_no_error():
    xs = from_iterable(range(0, 5))
    ys = from_iterable(range(5, 10))
    result = []

    async def asend(value):
        log.debug("test_catch_no_error:asend(%s)", value)
        result.append(value)

    zs = catch_exception((xs, ys))

    await run(zs, AsyncAnonymousObserver(asend))
    assert result == list(range(5))