(client: Anthropic)
| 321 | |
| 322 | |
| 323 | def test_response_parse_pep604_union(client: Anthropic) -> None: |
| 324 | response = APIResponse( |
| 325 | raw=httpx2.Response(200, content=json.dumps({"a": "hello!"}), headers={"Content-Type": "application/json"}), |
| 326 | client=client, |
| 327 | stream=False, |
| 328 | stream_cls=None, |
| 329 | cast_to=str, |
| 330 | options=FinalRequestOptions.construct(method="get", url="/foo"), |
| 331 | ) |
| 332 | |
| 333 | obj = response.parse(to=cast(Any, CustomModel | OtherModel)) |
| 334 | assert isinstance(obj, OtherModel) |
| 335 | assert obj.a == "hello!" |
| 336 | |
| 337 | |
| 338 | @pytest.mark.asyncio |
nothing calls this directly
no test coverage detected