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

Function test_response_parse_mismatched_basemodel

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

Source from the content-addressed store, hash-verified

59
60
61def test_response_parse_mismatched_basemodel(client: OpenAI) -> None:
62 response = APIResponse(
63 raw=httpx.Response(200, content=b"foo"),
64 client=client,
65 stream=False,
66 stream_cls=None,
67 cast_to=str,
68 options=FinalRequestOptions.construct(method="get", url="/foo"),
69 )
70
71 with pytest.raises(
72 TypeError,
73 match="Pydantic models must subclass our base model type, e.g. `from openai import BaseModel`",
74 ):
75 response.parse(to=PydanticModel)
76
77
78@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