MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / test_message

Function test_message

tests/test_error_classes.py:149–166  ·  view source on GitHub ↗
(
    respx_mock: MockRouter,
    sync: bool,
    client: Anthropic,
    async_client: AsyncAnthropic,
    content: str,
    headers: dict[str, str],
    message: str,
)

Source from the content-addressed store, hash-verified

147 ],
148)
149async def test_message(
150 respx_mock: MockRouter,
151 sync: bool,
152 client: Anthropic,
153 async_client: AsyncAnthropic,
154 content: str,
155 headers: dict[str, str],
156 message: str,
157) -> None:
158 respx_mock.get("/foo").mock(return_value=httpx2.Response(400, content=content, headers=headers))
159
160 with pytest.raises(APIStatusError) as error:
161 if sync:
162 client.get("/foo?bar=baz", cast_to=httpx2.Response)
163 else:
164 await async_client.get("/foo?bar=baz", cast_to=httpx2.Response)
165
166 assert error.value.message == message
167
168
169@pytest.mark.respx(base_url=base_url)

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected