Home / Class/ TestAsyncModels Class — anthropic-sdk-python Architecture

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
  eb688261_90e1_2c04_44e6_4e1a0fbf404e["TestAsyncModels"]
  0ee4aaa4_2fac_369a_7acd_4fcab154d0c2["BetaModelInfo"]
  eb688261_90e1_2c04_44e6_4e1a0fbf404e -->|extends| 0ee4aaa4_2fac_369a_7acd_4fcab154d0c2
  cb00baf8_f406_80c3_d958_9edd1a3e6a98["test_models.py"]
  eb688261_90e1_2c04_44e6_4e1a0fbf404e -->|defined in| cb00baf8_f406_80c3_d958_9edd1a3e6a98
  82f90aba_2ac6_68d3_d6ee_a0d88e3f6e38["test_method_retrieve()"]
  eb688261_90e1_2c04_44e6_4e1a0fbf404e -->|method| 82f90aba_2ac6_68d3_d6ee_a0d88e3f6e38
  9471b9c9_cf6c_b24d_dc55_6e997322e4a8["test_method_retrieve_with_all_params()"]
  eb688261_90e1_2c04_44e6_4e1a0fbf404e -->|method| 9471b9c9_cf6c_b24d_dc55_6e997322e4a8
  abcfabc9_b926_a194_6535_d7eeb650298f["test_raw_response_retrieve()"]
  eb688261_90e1_2c04_44e6_4e1a0fbf404e -->|method| abcfabc9_b926_a194_6535_d7eeb650298f
  7423337f_6a63_99ea_805f_6bc28abec70d["test_streaming_response_retrieve()"]
  eb688261_90e1_2c04_44e6_4e1a0fbf404e -->|method| 7423337f_6a63_99ea_805f_6bc28abec70d
  6c64a724_6588_c69a_1ff3_325243e5c571["test_path_params_retrieve()"]
  eb688261_90e1_2c04_44e6_4e1a0fbf404e -->|method| 6c64a724_6588_c69a_1ff3_325243e5c571
  984d025b_23ca_d99d_9249_50f4914cf542["test_method_list()"]
  eb688261_90e1_2c04_44e6_4e1a0fbf404e -->|method| 984d025b_23ca_d99d_9249_50f4914cf542
  431bb9d6_3cd0_521f_2453_58d69e659428["test_method_list_with_all_params()"]
  eb688261_90e1_2c04_44e6_4e1a0fbf404e -->|method| 431bb9d6_3cd0_521f_2453_58d69e659428
  e673532e_fb4a_a994_5bdd_d265c00a00f9["test_raw_response_list()"]
  eb688261_90e1_2c04_44e6_4e1a0fbf404e -->|method| e673532e_fb4a_a994_5bdd_d265c00a00f9
  2628ebed_be66_54cd_dbf5_56c2bfb0f251["test_streaming_response_list()"]
  eb688261_90e1_2c04_44e6_4e1a0fbf404e -->|method| 2628ebed_be66_54cd_dbf5_56c2bfb0f251

Relationship Graph

Source Code

tests/api_resources/beta/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.beta.models.retrieve(
            model_id="model_id",
        )
        assert_matches_type(BetaModelInfo, model, path=["response"])

    @parametrize
    async def test_method_retrieve_with_all_params(self, async_client: AsyncAnthropic) -> None:
        model = await async_client.beta.models.retrieve(
            model_id="model_id",
            betas=["string"],
        )
        assert_matches_type(BetaModelInfo, model, path=["response"])

    @parametrize
    async def test_raw_response_retrieve(self, async_client: AsyncAnthropic) -> None:
        response = await async_client.beta.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(BetaModelInfo, model, path=["response"])

    @parametrize
    async def test_streaming_response_retrieve(self, async_client: AsyncAnthropic) -> None:
        async with async_client.beta.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(BetaModelInfo, 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.beta.models.with_raw_response.retrieve(
                model_id="",
            )

    @parametrize
    async def test_method_list(self, async_client: AsyncAnthropic) -> None:
        model = await async_client.beta.models.list()
        assert_matches_type(AsyncPage[BetaModelInfo], model, path=["response"])

    @parametrize
    async def test_method_list_with_all_params(self, async_client: AsyncAnthropic) -> None:
        model = await async_client.beta.models.list(
            after_id="after_id",
            before_id="before_id",
            limit=1,
            betas=["string"],
        )
        assert_matches_type(AsyncPage[BetaModelInfo], model, path=["response"])

    @parametrize
    async def test_raw_response_list(self, async_client: AsyncAnthropic) -> None:
        response = await async_client.beta.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[BetaModelInfo], model, path=["response"])

    @parametrize
    async def test_streaming_response_list(self, async_client: AsyncAnthropic) -> None:
        async with async_client.beta.models.with_streaming_response.list() as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

Extends

Frequently Asked Questions

What is the TestAsyncModels class?
TestAsyncModels is a class in the anthropic-sdk-python codebase, defined in tests/api_resources/beta/test_models.py.
Where is TestAsyncModels defined?
TestAsyncModels is defined in tests/api_resources/beta/test_models.py at line 103.
What does TestAsyncModels extend?
TestAsyncModels extends BetaModelInfo.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free