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))
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))
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))