MCPcopy
hub / github.com/openai/openai-python / test_data_missing_event

Function test_data_missing_event

tests/test_streaming.py:31–42  ·  view source on GitHub ↗
(sync: bool, client: OpenAI, async_client: AsyncOpenAI)

Source from the content-addressed store, hash-verified

29@pytest.mark.asyncio
30@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"])
31async def test_data_missing_event(sync: bool, client: OpenAI, async_client: AsyncOpenAI) -> None:
32 def body() -> Iterator[bytes]:
33 yield b'data: {"foo":true}\n'
34 yield b"\n"
35
36 iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client)
37
38 sse = await iter_next(iterator)
39 assert sse.event is None
40 assert sse.json() == {"foo": True}
41
42 await assert_empty_iter(iterator)
43
44
45@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 5

make_event_iteratorFunction · 0.85
iter_nextFunction · 0.85
assert_empty_iterFunction · 0.85
bodyFunction · 0.70
jsonMethod · 0.45

Tested by

no test coverage detected