TestAsyncModels Class — anthropic-sdk-python Architecture
Architecture documentation for the TestAsyncModels class in test_models.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD 4b7623f2_eb9e_b859_2031_76f8a6e17f78["TestAsyncModels"] 2608af38_7f25_6a41_86ce_050d21936c7a["ModelInfo"] 4b7623f2_eb9e_b859_2031_76f8a6e17f78 -->|extends| 2608af38_7f25_6a41_86ce_050d21936c7a 6ce0fdb0_f6fa_7237_400b_a01fc41eb776["test_models.py"] 4b7623f2_eb9e_b859_2031_76f8a6e17f78 -->|defined in| 6ce0fdb0_f6fa_7237_400b_a01fc41eb776 bfee12ee_f004_0988_2589_66d16d41a804["test_method_retrieve()"] 4b7623f2_eb9e_b859_2031_76f8a6e17f78 -->|method| bfee12ee_f004_0988_2589_66d16d41a804 b0be27e6_8ae9_ff8f_4f79_04a7cc44e1f1["test_method_retrieve_with_all_params()"] 4b7623f2_eb9e_b859_2031_76f8a6e17f78 -->|method| b0be27e6_8ae9_ff8f_4f79_04a7cc44e1f1 45b34e48_ab45_df4a_fcb5_aaacae115254["test_raw_response_retrieve()"] 4b7623f2_eb9e_b859_2031_76f8a6e17f78 -->|method| 45b34e48_ab45_df4a_fcb5_aaacae115254 47bf0442_c2b7_d087_cd7e_87a0b89f05d9["test_streaming_response_retrieve()"] 4b7623f2_eb9e_b859_2031_76f8a6e17f78 -->|method| 47bf0442_c2b7_d087_cd7e_87a0b89f05d9 3edcc45e_4bbf_3f22_9366_4e181d5d0473["test_path_params_retrieve()"] 4b7623f2_eb9e_b859_2031_76f8a6e17f78 -->|method| 3edcc45e_4bbf_3f22_9366_4e181d5d0473 524671a7_3287_63d5_56d3_c1991f4bc661["test_method_list()"] 4b7623f2_eb9e_b859_2031_76f8a6e17f78 -->|method| 524671a7_3287_63d5_56d3_c1991f4bc661 a9a0ade8_599a_5d42_97c9_9fa8ffdd1cd3["test_method_list_with_all_params()"] 4b7623f2_eb9e_b859_2031_76f8a6e17f78 -->|method| a9a0ade8_599a_5d42_97c9_9fa8ffdd1cd3 28997764_af6f_3339_c0b0_eed95828e5f2["test_raw_response_list()"] 4b7623f2_eb9e_b859_2031_76f8a6e17f78 -->|method| 28997764_af6f_3339_c0b0_eed95828e5f2 a4015b9d_ed22_cdba_8d15_7622c3c2c63b["test_streaming_response_list()"] 4b7623f2_eb9e_b859_2031_76f8a6e17f78 -->|method| a4015b9d_ed22_cdba_8d15_7622c3c2c63b
Relationship Graph
Source Code
tests/api_resources/test_models.py lines 103–187
class TestAsyncModels:
parametrize = pytest.mark.parametrize(
"async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"]
)
@parametrize
async def test_method_retrieve(self, async_client: AsyncAnthropic) -> None:
model = await async_client.models.retrieve(
model_id="model_id",
)
assert_matches_type(ModelInfo, model, path=["response"])
@parametrize
async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropic) -> None:
model = await async_client.models.retrieve(
model_id="model_id",
betas=["string"],
)
assert_matches_type(ModelInfo, model, path=["response"])
@parametrize
async def test_raw_response_retrieve(self, async_client: AsyncAnthropic) -> None:
response = await async_client.models.with_raw_response.retrieve(
model_id="model_id",
)
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
model = response.parse()
assert_matches_type(ModelInfo, model, path=["response"])
@parametrize
async def test_streaming_response_retrieve(self, async_client: AsyncAnthropic) -> None:
async with async_client.models.with_streaming_response.retrieve(
model_id="model_id",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
model = await response.parse()
assert_matches_type(ModelInfo, model, path=["response"])
assert cast(Any, response.is_closed) is True
@parametrize
async def test_path_params_retrieve(self, async_client: AsyncAnthropic) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_id` but received ''"):
await async_client.models.with_raw_response.retrieve(
model_id="",
)
@parametrize
async def test_method_list(self, async_client: AsyncAnthropic) -> None:
model = await async_client.models.list()
assert_matches_type(AsyncPage[ModelInfo], model, path=["response"])
@parametrize
async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) -> None:
model = await async_client.models.list(
after_id="after_id",
before_id="before_id",
limit=1,
betas=["string"],
)
assert_matches_type(AsyncPage[ModelInfo], model, path=["response"])
@parametrize
async def test_raw_response_list(self, async_client: AsyncAnthropic) -> None:
response = await async_client.models.with_raw_response.list()
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
model = response.parse()
assert_matches_type(AsyncPage[ModelInfo], model, path=["response"])
@parametrize
async def test_streaming_response_list(self, async_client: AsyncAnthropic) -> None:
async with async_client.models.with_streaming_response.list() as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Domain
Defined In
Extends
Source
Frequently Asked Questions
What is the TestAsyncModels class?
TestAsyncModels is a class in the anthropic-sdk-python codebase, defined in tests/api_resources/test_models.py.
Where is TestAsyncModels defined?
TestAsyncModels is defined in tests/api_resources/test_models.py at line 103.
What does TestAsyncModels extend?
TestAsyncModels extends ModelInfo.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free