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

TestModels Class — anthropic-sdk-python Architecture

Architecture documentation for the TestModels class in test_models.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  d2a8036e_d9b2_cf15_b23c_42620ea850f0["TestModels"]
  0ee4aaa4_2fac_369a_7acd_4fcab154d0c2["BetaModelInfo"]
  d2a8036e_d9b2_cf15_b23c_42620ea850f0 -->|extends| 0ee4aaa4_2fac_369a_7acd_4fcab154d0c2
  cb00baf8_f406_80c3_d958_9edd1a3e6a98["test_models.py"]
  d2a8036e_d9b2_cf15_b23c_42620ea850f0 -->|defined in| cb00baf8_f406_80c3_d958_9edd1a3e6a98
  8cf3871e_8ddc_5870_2ee6_efd80cff6ced["test_method_retrieve()"]
  d2a8036e_d9b2_cf15_b23c_42620ea850f0 -->|method| 8cf3871e_8ddc_5870_2ee6_efd80cff6ced
  9bceff8f_a721_6e1b_6ed8_a01648ee5f4c["test_method_retrieve_with_all_params()"]
  d2a8036e_d9b2_cf15_b23c_42620ea850f0 -->|method| 9bceff8f_a721_6e1b_6ed8_a01648ee5f4c
  839b9f3f_d6ff_f918_756d_09f3d38a86bc["test_raw_response_retrieve()"]
  d2a8036e_d9b2_cf15_b23c_42620ea850f0 -->|method| 839b9f3f_d6ff_f918_756d_09f3d38a86bc
  689d8c9d_0e96_73b8_f900_2c0374a5be5a["test_streaming_response_retrieve()"]
  d2a8036e_d9b2_cf15_b23c_42620ea850f0 -->|method| 689d8c9d_0e96_73b8_f900_2c0374a5be5a
  261c3790_6d16_75fc_513e_5e97d11a944b["test_path_params_retrieve()"]
  d2a8036e_d9b2_cf15_b23c_42620ea850f0 -->|method| 261c3790_6d16_75fc_513e_5e97d11a944b
  9d667121_76cd_b3f9_b25c_93ba5f05d532["test_method_list()"]
  d2a8036e_d9b2_cf15_b23c_42620ea850f0 -->|method| 9d667121_76cd_b3f9_b25c_93ba5f05d532
  fc0abfa5_952e_48b3_0751_834abe1225e9["test_method_list_with_all_params()"]
  d2a8036e_d9b2_cf15_b23c_42620ea850f0 -->|method| fc0abfa5_952e_48b3_0751_834abe1225e9
  1ee656d5_2303_af2d_b274_f91974881ef5["test_raw_response_list()"]
  d2a8036e_d9b2_cf15_b23c_42620ea850f0 -->|method| 1ee656d5_2303_af2d_b274_f91974881ef5
  3bb1a094_b847_7950_5226_b6b522a56995["test_streaming_response_list()"]
  d2a8036e_d9b2_cf15_b23c_42620ea850f0 -->|method| 3bb1a094_b847_7950_5226_b6b522a56995

Relationship Graph

Source Code

tests/api_resources/beta/test_models.py lines 18–100

class TestModels:
    parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])

    @parametrize
    def test_method_retrieve(self, client: Anthropic) -> None:
        model = client.beta.models.retrieve(
            model_id="model_id",
        )
        assert_matches_type(BetaModelInfo, model, path=["response"])

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

    @parametrize
    def test_raw_response_retrieve(self, client: Anthropic) -> None:
        response = 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
    def test_streaming_response_retrieve(self, client: Anthropic) -> None:
        with 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 = response.parse()
            assert_matches_type(BetaModelInfo, model, path=["response"])

        assert cast(Any, response.is_closed) is True

    @parametrize
    def test_path_params_retrieve(self, client: Anthropic) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `model_id` but received ''"):
            client.beta.models.with_raw_response.retrieve(
                model_id="",
            )

    @parametrize
    def test_method_list(self, client: Anthropic) -> None:
        model = client.beta.models.list()
        assert_matches_type(SyncPage[BetaModelInfo], model, path=["response"])

    @parametrize
    def test_method_list_with_all_params(self, client: Anthropic) -> None:
        model = client.beta.models.list(
            after_id="after_id",
            before_id="before_id",
            limit=1,
            betas=["string"],
        )
        assert_matches_type(SyncPage[BetaModelInfo], model, path=["response"])

    @parametrize
    def test_raw_response_list(self, client: Anthropic) -> None:
        response = 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(SyncPage[BetaModelInfo], model, path=["response"])

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

            model = response.parse()
            assert_matches_type(SyncPage[BetaModelInfo], model, path=["response"])

Extends

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free