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

Method test_default_stream_cls

tests/test_client.py:1044–1052  ·  tests/test_client.py::TestOpenAI.test_default_stream_cls
(self, respx_mock: MockRouter, client: OpenAI)

Source from the content-addressed store, hash-verified

1042
1043 @pytest.mark.respx(base_url=base_url)
1044 def test_default_stream_cls(self, respx_mock: MockRouter, client: OpenAI) -> None:
1045 class Model(BaseModel):
1046 name: str
1047
1048 respx_mock.post(class="st">"/foo").mock(return_value=httpx.Response(200, json={class="st">"foo": class="st">"bar"}))
1049
1050 stream = client.post(class="st">"/foo", cast_to=Model, stream=True, stream_cls=Stream[Model])
1051 assert isinstance(stream, Stream)
1052 stream.response.close()
1053
1054 @pytest.mark.respx(base_url=base_url)
1055 def test_received_text_for_expected_json(self, respx_mock: MockRouter) -> None:

Callers

nothing calls this directly

Calls 2

postMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected