MCPcopy Index your code
hub / github.com/openai/openai-python / test_response_parse_custom_model

Function test_response_parse_custom_model

tests/test_legacy_response.py:81–93  ·  view source on GitHub ↗
(client: OpenAI)

Source from the content-addressed store, hash-verified

79
80
81def test_response_parse_custom_model(client: OpenAI) -> None:
82 response = LegacyAPIResponse(
83 raw=httpx.Response(200, content=json.dumps({"foo": "hello!", "bar": 2})),
84 client=client,
85 stream=False,
86 stream_cls=None,
87 cast_to=str,
88 options=FinalRequestOptions.construct(method="get", url="/foo"),
89 )
90
91 obj = response.parse(to=CustomModel)
92 assert obj.foo == "hello!"
93 assert obj.bar == 2
94
95
96def test_response_basemodel_request_id(client: OpenAI) -> None:

Callers

nothing calls this directly

Calls 3

parseMethod · 0.95
LegacyAPIResponseClass · 0.90
constructMethod · 0.45

Tested by

no test coverage detected