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

Function test_response_parse_custom_model

tests/test_response.py:130–142  ·  view source on GitHub ↗
(client: OpenAI)

Source from the content-addressed store, hash-verified

128
129
130def test_response_parse_custom_model(client: OpenAI) -> None:
131 response = APIResponse(
132 raw=httpx.Response(200, content=json.dumps({"foo": "hello!", "bar": 2})),
133 client=client,
134 stream=False,
135 stream_cls=None,
136 cast_to=str,
137 options=FinalRequestOptions.construct(method="get", url="/foo"),
138 )
139
140 obj = response.parse(to=CustomModel)
141 assert obj.foo == "hello!"
142 assert obj.bar == 2
143
144
145@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 3

parseMethod · 0.95
APIResponseClass · 0.90
constructMethod · 0.45

Tested by

no test coverage detected