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

Function test_event_missing_data

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

Source from the content-addressed store, hash-verified

45@pytest.mark.asyncio
46@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"])
47async def test_event_missing_data(sync: bool, client: OpenAI, async_client: AsyncOpenAI) -> None:
48 def body() -> Iterator[bytes]:
49 yield b"event: ping\n"
50 yield b"\n"
51
52 iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client)
53
54 sse = await iter_next(iterator)
55 assert sse.event == "ping"
56 assert sse.data == ""
57
58 await assert_empty_iter(iterator)
59
60
61@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 4

make_event_iteratorFunction · 0.85
iter_nextFunction · 0.85
assert_empty_iterFunction · 0.85
bodyFunction · 0.70

Tested by

no test coverage detected