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

Method test_default_stream_cls

tests/test_client.py:2300–2308  ·  view source on GitHub ↗
(self, respx_mock: MockRouter, async_client: AsyncOpenAI)

Source from the content-addressed store, hash-verified

2298
2299 @pytest.mark.respx(base_url=base_url)
2300 async def test_default_stream_cls(self, respx_mock: MockRouter, async_client: AsyncOpenAI) -> None:
2301 class Model(BaseModel):
2302 name: str
2303
2304 respx_mock.post("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
2305
2306 stream = await async_client.post("/foo", cast_to=Model, stream=True, stream_cls=AsyncStream[Model])
2307 assert isinstance(stream, AsyncStream)
2308 await stream.response.aclose()
2309
2310 @pytest.mark.respx(base_url=base_url)
2311 async def test_received_text_for_expected_json(self, respx_mock: MockRouter) -> None:

Callers

nothing calls this directly

Calls 2

acloseMethod · 0.80
postMethod · 0.45

Tested by

no test coverage detected