(client: OpenAI)
| 128 | |
| 129 | |
| 130 | def 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 |
nothing calls this directly
no test coverage detected