(sync: bool, client: Anthropic, async_client: AsyncAnthropic)
| 78 | @pytest.mark.asyncio |
| 79 | @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) |
| 80 | async def test_multiple_events(sync: bool, client: Anthropic, async_client: AsyncAnthropic) -> None: |
| 81 | def body() -> Iterator[bytes]: |
| 82 | yield b"event: ping\n" |
| 83 | yield b"\n" |
| 84 | yield b"event: completion\n" |
| 85 | yield b"\n" |
| 86 | |
| 87 | iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) |
| 88 | |
| 89 | sse = await iter_next(iterator) |
| 90 | assert sse.event == "ping" |
| 91 | assert sse.data == "" |
| 92 | |
| 93 | sse = await iter_next(iterator) |
| 94 | assert sse.event == "completion" |
| 95 | assert sse.data == "" |
| 96 | |
| 97 | await assert_empty_iter(iterator) |
| 98 | |
| 99 | |
| 100 | @pytest.mark.asyncio |
nothing calls this directly
no test coverage detected