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
  e20ec084_064b_c6a0_bacb_3c3c1c22bd7d["TestAsyncMessages"]
  01beb2f6_442c_779e_7c57_22078b50dcf4["Message"]
  e20ec084_064b_c6a0_bacb_3c3c1c22bd7d -->|extends| 01beb2f6_442c_779e_7c57_22078b50dcf4
  b1b6ca15_8f4d_07a7_bcea_2f38fa0417f4["MessageTokensCount"]
  e20ec084_064b_c6a0_bacb_3c3c1c22bd7d -->|extends| b1b6ca15_8f4d_07a7_bcea_2f38fa0417f4
  5e472438_e610_3036_dbd4_fe8abc316021["test_messages.py"]
  e20ec084_064b_c6a0_bacb_3c3c1c22bd7d -->|defined in| 5e472438_e610_3036_dbd4_fe8abc316021
  86d96ad9_e759_7710_be85_08e5d6c6beab["test_method_create_overload_1()"]
  e20ec084_064b_c6a0_bacb_3c3c1c22bd7d -->|method| 86d96ad9_e759_7710_be85_08e5d6c6beab
  ce24b196_2007_c5f9_a9f8_daa888f96b7d["test_method_create_with_all_params_overload_1()"]
  e20ec084_064b_c6a0_bacb_3c3c1c22bd7d -->|method| ce24b196_2007_c5f9_a9f8_daa888f96b7d
  570ac504_46d6_01c6_310c_55333317ce46["test_raw_response_create_overload_1()"]
  e20ec084_064b_c6a0_bacb_3c3c1c22bd7d -->|method| 570ac504_46d6_01c6_310c_55333317ce46
  809b613b_5e7d_9ac7_733d_f451fff7c913["test_streaming_response_create_overload_1()"]
  e20ec084_064b_c6a0_bacb_3c3c1c22bd7d -->|method| 809b613b_5e7d_9ac7_733d_f451fff7c913
  5315d325_9f2c_55bf_d4df_db45f2de408a["test_method_create_overload_2()"]
  e20ec084_064b_c6a0_bacb_3c3c1c22bd7d -->|method| 5315d325_9f2c_55bf_d4df_db45f2de408a
  23b7c873_c1c4_b706_8f42_9b124837ff95["test_method_create_with_all_params_overload_2()"]
  e20ec084_064b_c6a0_bacb_3c3c1c22bd7d -->|method| 23b7c873_c1c4_b706_8f42_9b124837ff95
  6ae1d4cb_591b_8cd2_9053_988bf245cd8a["test_raw_response_create_overload_2()"]
  e20ec084_064b_c6a0_bacb_3c3c1c22bd7d -->|method| 6ae1d4cb_591b_8cd2_9053_988bf245cd8a
  baf47704_301d_7024_d001_fb01a0862872["test_streaming_response_create_overload_2()"]
  e20ec084_064b_c6a0_bacb_3c3c1c22bd7d -->|method| baf47704_301d_7024_d001_fb01a0862872
  00ba1acb_2286_b9f7_0bb3_640c1e78512a["test_deprecated_model_warning()"]
  e20ec084_064b_c6a0_bacb_3c3c1c22bd7d -->|method| 00ba1acb_2286_b9f7_0bb3_640c1e78512a
  1ec4062a_9077_9980_ec14_f4f3313fe1fb["test_method_count_tokens()"]
  e20ec084_064b_c6a0_bacb_3c3c1c22bd7d -->|method| 1ec4062a_9077_9980_ec14_f4f3313fe1fb
  bfabf7b9_23da_e12a_0fb6_eba7e2dc809b["test_method_count_tokens_with_all_params()"]
  e20ec084_064b_c6a0_bacb_3c3c1c22bd7d -->|method| bfabf7b9_23da_e12a_0fb6_eba7e2dc809b

Relationship Graph

Source Code

tests/api_resources/test_messages.py lines 412–802

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

    @parametrize
    async def test_method_create_overload_1(self, async_client: AsyncAnthropic) -> None:
        message = await async_client.messages.create(
            max_tokens=1024,
            messages=[
                {
                    "content": "Hello, world",
                    "role": "user",
                }
            ],
            model="claude-opus-4-6",
        )
        assert_matches_type(Message, message, path=["response"])

    @parametrize
    async def test_method_create_with_all_params_overload_1(self, async_client: AsyncAnthropic) -> None:
        message = await async_client.messages.create(
            max_tokens=1024,
            messages=[
                {
                    "content": "Hello, world",
                    "role": "user",
                }
            ],
            model="claude-opus-4-6",
            inference_geo="inference_geo",
            metadata={"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"},
            output_config={
                "effort": "low",
                "format": {
                    "schema": {"foo": "bar"},
                    "type": "json_schema",
                },
            },
            service_tier="auto",
            stop_sequences=["string"],
            stream=False,
            system=[
                {
                    "text": "Today's date is 2024-06-01.",
                    "type": "text",
                    "cache_control": {
                        "type": "ephemeral",
                        "ttl": "5m",
                    },
                    "citations": [
                        {
                            "cited_text": "cited_text",
                            "document_index": 0,
                            "document_title": "x",
                            "end_char_index": 0,
                            "start_char_index": 0,
                            "type": "char_location",
                        }
                    ],
                }
            ],
            temperature=1,
            thinking={
                "type": "adaptive",
            },
            tool_choice={
                "type": "auto",
                "disable_parallel_tool_use": True,
            },
            tools=[
                {
                    "input_schema": {
                        "type": "object",
                        "properties": {
                            "location": "bar",
                            "unit": "bar",
                        },
                        "required": ["location"],
                    },
                    "name": "name",

Frequently Asked Questions

What is the TestAsyncMessages class?
TestAsyncMessages is a class in the anthropic-sdk-python codebase, defined in tests/api_resources/test_messages.py.
Where is TestAsyncMessages defined?
TestAsyncMessages is defined in tests/api_resources/test_messages.py at line 412.
What does TestAsyncMessages extend?
TestAsyncMessages extends Message, MessageTokensCount.

Analyze Your Own Codebase

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

Try Supermodel Free