MCPcopy
hub / github.com/scrapy/scrapy / test_iter_errback_bad

Method test_iter_errback_bad

tests/test_utils_defer.py:105–116  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

103
104 @coroutine_test
105 async def test_iter_errback_bad(self):
106 async def iterbad() -> AsyncGenerator[int, None]:
107 for x in range(10):
108 if x == 5:
109 1 / 0
110 yield x
111
112 errors = []
113 out = await collect_asyncgen(aiter_errback(iterbad(), errors.append))
114 assert out == [0, 1, 2, 3, 4]
115 assert len(errors) == 1
116 assert isinstance(errors[0].value, ZeroDivisionError)
117
118
119class TestAsyncDefTestsuite:

Callers

nothing calls this directly

Calls 2

collect_asyncgenFunction · 0.90
aiter_errbackFunction · 0.90

Tested by

no test coverage detected