(client: OpenAI)
| 59 | |
| 60 | |
| 61 | def 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 |
nothing calls this directly
no test coverage detected