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