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

Function test_response_parse_custom_model

tests/test_response.py:130–142  ·  tests/test_response.py::test_response_parse_custom_model
(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({class="st">"foo": class="st">"hello!", class="st">"bar": 2})),
133 client=client,
134 stream=False,
135 stream_cls=None,
136 cast_to=str,
137 options=FinalRequestOptions.construct(method=class="st">"get", url=class="st">"/foo"),
138 )
139
140 obj = response.parse(to=CustomModel)
141 assert obj.foo == class="st">"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