MCPcopy
hub / github.com/anthropics/anthropic-sdk-python / test_response_parse_custom_model

Function test_response_parse_custom_model

tests/test_response.py:128–140  ·  view source on GitHub ↗
(client: Anthropic)

Source from the content-addressed store, hash-verified

126
127
128def test_response_parse_custom_model(client: Anthropic) -> None:
129 response = APIResponse(
130 raw=httpx.Response(200, content=json.dumps({"foo": "hello!", "bar": 2})),
131 client=client,
132 stream=False,
133 stream_cls=None,
134 cast_to=str,
135 options=FinalRequestOptions.construct(method="get", url="/foo"),
136 )
137
138 obj = response.parse(to=CustomModel)
139 assert obj.foo == "hello!"
140 assert obj.bar == 2
141
142
143@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