Collects garbage and checks that this closes what was dropped, so that it means something if the rest is open.
(client: AsyncAnthropic)
| 306 | |
| 307 | |
| 308 | async def async_collect(client: AsyncAnthropic) -> None: |
| 309 | """Collects garbage and checks that this closes what was dropped, so that it means something if the rest is open.""" |
| 310 | dropped = Body() |
| 311 | stream = await async_requester(client, dropped)() |
| 312 | await anext(stream) |
| 313 | in_a_cycle(stream) |
| 314 | del stream |
| 315 | gc.collect() |
| 316 | await dropped.wait_closed() |
| 317 | assert dropped.closes == 1 |
| 318 | |
| 319 | |
| 320 | @dataclass(frozen=True) |