MCPcopy Create free account
hub / github.com/openai/openai-python / test_async_response_parse_custom_stream

Function test_async_response_parse_custom_stream

tests/test_response.py:111–122  ·  view source on GitHub ↗
(async_client: AsyncOpenAI)

Source from the content-addressed store, hash-verified

109
110@pytest.mark.asyncio
111async def test_async_response_parse_custom_stream(async_client: AsyncOpenAI) -> None:
112 response = AsyncAPIResponse(
113 raw=httpx.Response(200, content=b"foo"),
114 client=async_client,
115 stream=True,
116 stream_cls=None,
117 cast_to=str,
118 options=FinalRequestOptions.construct(method="get", url="/foo"),
119 )
120
121 stream = await response.parse(to=Stream[int])
122 assert stream._cast_to == int
123
124
125class CustomModel(BaseModel):

Callers

nothing calls this directly

Calls 3

parseMethod · 0.95
AsyncAPIResponseClass · 0.90
constructMethod · 0.45

Tested by

no test coverage detected