(sync: bool, client: OpenAI, async_client: AsyncOpenAI)
| 12 | @pytest.mark.asyncio |
| 13 | @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) |
| 14 | async def test_basic(sync: bool, client: OpenAI, async_client: AsyncOpenAI) -> None: |
| 15 | def body() -> Iterator[bytes]: |
| 16 | yield b"event: completion\n" |
| 17 | yield b'data: {"foo":true}\n' |
| 18 | yield b"\n" |
| 19 | |
| 20 | iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) |
| 21 | |
| 22 | sse = await iter_next(iterator) |
| 23 | assert sse.event == "completion" |
| 24 | assert sse.json() == {"foo": True} |
| 25 | |
| 26 | await assert_empty_iter(iterator) |
| 27 | |
| 28 | |
| 29 | @pytest.mark.asyncio |
nothing calls this directly
no test coverage detected