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

TestAsyncMessages Class — anthropic-sdk-python Architecture

Architecture documentation for the TestAsyncMessages class in test_messages.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  8298da58_cf54_f234_c9e6_f284f44aa796["TestAsyncMessages"]
  0da6889b_9352_8c02_9f21_a1deb1bdab0f["BetaMessage"]
  8298da58_cf54_f234_c9e6_f284f44aa796 -->|extends| 0da6889b_9352_8c02_9f21_a1deb1bdab0f
  8e1487ea_5f5a_d3f4_5ccc_5fd3414c75a4["BetaMessageTokensCount"]
  8298da58_cf54_f234_c9e6_f284f44aa796 -->|extends| 8e1487ea_5f5a_d3f4_5ccc_5fd3414c75a4
  1c8a15e3_0d33_599b_c076_58c2e38c4fe0["test_messages.py"]
  8298da58_cf54_f234_c9e6_f284f44aa796 -->|defined in| 1c8a15e3_0d33_599b_c076_58c2e38c4fe0
  e502dfdb_967f_1ad0_3851_1b3ccf98b667["test_method_create_overload_1()"]
  8298da58_cf54_f234_c9e6_f284f44aa796 -->|method| e502dfdb_967f_1ad0_3851_1b3ccf98b667
  b5631fb5_d42b_dd42_6132_8cc01b3f8a6b["test_method_create_with_all_params_overload_1()"]
  8298da58_cf54_f234_c9e6_f284f44aa796 -->|method| b5631fb5_d42b_dd42_6132_8cc01b3f8a6b
  cb7c89c3_53dd_fd4a_3883_6239d9fce038["test_raw_response_create_overload_1()"]
  8298da58_cf54_f234_c9e6_f284f44aa796 -->|method| cb7c89c3_53dd_fd4a_3883_6239d9fce038
  b8a93a1a_41f9_d0cf_4f49_62aafa0408ac["test_streaming_response_create_overload_1()"]
  8298da58_cf54_f234_c9e6_f284f44aa796 -->|method| b8a93a1a_41f9_d0cf_4f49_62aafa0408ac
  fd5c3143_59ba_514a_fdc5_3531d817c82d["test_method_create_overload_2()"]
  8298da58_cf54_f234_c9e6_f284f44aa796 -->|method| fd5c3143_59ba_514a_fdc5_3531d817c82d
  802ea0a5_f7d9_afc0_ffe6_35062f1d67b7["test_method_create_with_all_params_overload_2()"]
  8298da58_cf54_f234_c9e6_f284f44aa796 -->|method| 802ea0a5_f7d9_afc0_ffe6_35062f1d67b7
  829fb40a_f4d8_4cce_3766_a94bf73e65c0["test_raw_response_create_overload_2()"]
  8298da58_cf54_f234_c9e6_f284f44aa796 -->|method| 829fb40a_f4d8_4cce_3766_a94bf73e65c0
  da6c07d8_9b5a_d857_9ab2_78b28f7228b3["test_streaming_response_create_overload_2()"]
  8298da58_cf54_f234_c9e6_f284f44aa796 -->|method| da6c07d8_9b5a_d857_9ab2_78b28f7228b3
  f292d199_05fe_ee61_2d5a_dab0cdaa3f13["test_method_count_tokens()"]
  8298da58_cf54_f234_c9e6_f284f44aa796 -->|method| f292d199_05fe_ee61_2d5a_dab0cdaa3f13
  792f9665_d0eb_15e8_ac70_f8761a12b788["test_method_count_tokens_with_all_params()"]
  8298da58_cf54_f234_c9e6_f284f44aa796 -->|method| 792f9665_d0eb_15e8_ac70_f8761a12b788
  8a97c6c2_7280_92db_7499_a25cdf402655["test_raw_response_count_tokens()"]
  8298da58_cf54_f234_c9e6_f284f44aa796 -->|method| 8a97c6c2_7280_92db_7499_a25cdf402655

Relationship Graph

Source Code

tests/api_resources/beta/test_messages.py lines 580–1138

class TestAsyncMessages:
    parametrize = pytest.mark.parametrize(
        "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"]
    )

    @pytest.mark.skip(reason="prism validates based on the non-beta endpoint")
    @parametrize
    async def test_method_create_overload_1(self, async_client: AsyncAnthropic) -> None:
        message = await async_client.beta.messages.create(
            max_tokens=1024,
            messages=[
                {
                    "content": "Hello, world",
                    "role": "user",
                }
            ],
            model="claude-opus-4-6",
        )
        assert_matches_type(BetaMessage, message, path=["response"])

    @pytest.mark.skip(reason="prism validates based on the non-beta endpoint")
    @parametrize
    async def test_method_create_with_all_params_overload_1(self, async_client: AsyncAnthropic) -> None:
        message = await async_client.beta.messages.create(
            max_tokens=1024,
            messages=[
                {
                    "content": "Hello, world",
                    "role": "user",
                }
            ],
            model="claude-opus-4-6",
            container={
                "id": "id",
                "skills": [
                    {
                        "skill_id": "x",
                        "type": "anthropic",
                        "version": "x",
                    }
                ],
            },
            context_management={
                "edits": [
                    {
                        "type": "clear_tool_uses_20250919",
                        "clear_at_least": {
                            "type": "input_tokens",
                            "value": 0,
                        },
                        "clear_tool_inputs": True,
                        "exclude_tools": ["string"],
                        "keep": {
                            "type": "tool_uses",
                            "value": 0,
                        },
                        "trigger": {
                            "type": "input_tokens",
                            "value": 1,
                        },
                    }
                ]
            },
            inference_geo="inference_geo",
            mcp_servers=[
                {
                    "name": "name",
                    "type": "url",
                    "url": "url",
                    "authorization_token": "authorization_token",
                    "tool_configuration": {
                        "allowed_tools": ["string"],
                        "enabled": True,
                    },
                }
            ],
            metadata={"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"},
            output_config={
                "effort": "low",
                "format": {
                    "schema": {"foo": "bar"},

Frequently Asked Questions

What is the TestAsyncMessages class?
TestAsyncMessages is a class in the anthropic-sdk-python codebase, defined in tests/api_resources/beta/test_messages.py.
Where is TestAsyncMessages defined?
TestAsyncMessages is defined in tests/api_resources/beta/test_messages.py at line 580.
What does TestAsyncMessages extend?
TestAsyncMessages extends BetaMessage, BetaMessageTokensCount.

Analyze Your Own Codebase

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

Try Supermodel Free