Collects garbage and checks that this closes what was dropped, so that it means something if the rest is open.
(client: AsyncAnthropic)
| 288 | |
| 289 | |
| 290 | async def async_collect(client: AsyncAnthropic) -> None: |
| 291 | """Collects garbage and checks that this closes what was dropped, so that it means something if the rest is open.""" |
| 292 | dropped = Body() |
| 293 | stream = await async_requester(client, dropped)() |
| 294 | await anext(stream) |
| 295 | in_a_cycle(stream) |
| 296 | del stream |
| 297 | gc.collect() |
| 298 | await dropped.wait_closed() |
| 299 | assert dropped.closes == 1 |
| 300 | |
| 301 | |
| 302 | @dataclass(frozen=True) |