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

TestAsyncBatches Class — anthropic-sdk-python Architecture

Architecture documentation for the TestAsyncBatches class in test_batches.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  769e97f4_3598_dfb3_d867_79026059841d["TestAsyncBatches"]
  f922c9c7_4662_64d5_2ca5_4c99386cbece["BetaMessageBatch"]
  769e97f4_3598_dfb3_d867_79026059841d -->|extends| f922c9c7_4662_64d5_2ca5_4c99386cbece
  c40945ef_e03b_6b03_f6ae_8fc2dca315da["BetaDeletedMessageBatch"]
  769e97f4_3598_dfb3_d867_79026059841d -->|extends| c40945ef_e03b_6b03_f6ae_8fc2dca315da
  8338a118_0daa_4bed_30d9_2d313e1f3766["test_batches.py"]
  769e97f4_3598_dfb3_d867_79026059841d -->|defined in| 8338a118_0daa_4bed_30d9_2d313e1f3766
  a24c97ac_e87c_416d_564d_0e82f0668627["test_method_create()"]
  769e97f4_3598_dfb3_d867_79026059841d -->|method| a24c97ac_e87c_416d_564d_0e82f0668627
  a6a3b394_7d71_3f9e_c1a8_2e163f2826a5["test_method_create_with_all_params()"]
  769e97f4_3598_dfb3_d867_79026059841d -->|method| a6a3b394_7d71_3f9e_c1a8_2e163f2826a5
  51b81686_5c52_cd7c_5d0e_d33afb3afa83["test_raw_response_create()"]
  769e97f4_3598_dfb3_d867_79026059841d -->|method| 51b81686_5c52_cd7c_5d0e_d33afb3afa83
  cc2356f9_93e4_157c_9e20_b5915856a47a["test_streaming_response_create()"]
  769e97f4_3598_dfb3_d867_79026059841d -->|method| cc2356f9_93e4_157c_9e20_b5915856a47a
  8894bb25_9fbc_3022_0b7d_bbfce14acc57["test_method_retrieve()"]
  769e97f4_3598_dfb3_d867_79026059841d -->|method| 8894bb25_9fbc_3022_0b7d_bbfce14acc57
  1b41f8f1_5dab_f8fb_0a50_49275b38b315["test_method_retrieve_with_all_params()"]
  769e97f4_3598_dfb3_d867_79026059841d -->|method| 1b41f8f1_5dab_f8fb_0a50_49275b38b315
  f486c556_124e_2b6b_776b_858c3c1f6ce2["test_raw_response_retrieve()"]
  769e97f4_3598_dfb3_d867_79026059841d -->|method| f486c556_124e_2b6b_776b_858c3c1f6ce2
  35a42239_9b91_4358_2f98_8a9359fd28f5["test_streaming_response_retrieve()"]
  769e97f4_3598_dfb3_d867_79026059841d -->|method| 35a42239_9b91_4358_2f98_8a9359fd28f5
  291a3917_78e0_7457_8795_cb8e894f5b46["test_path_params_retrieve()"]
  769e97f4_3598_dfb3_d867_79026059841d -->|method| 291a3917_78e0_7457_8795_cb8e894f5b46
  ddc0ba71_0f3e_f9ef_1200_e3b548bb3a21["test_method_list()"]
  769e97f4_3598_dfb3_d867_79026059841d -->|method| ddc0ba71_0f3e_f9ef_1200_e3b548bb3a21
  3fcfed19_39b0_b31b_8ad4_7110c595f75b["test_method_list_with_all_params()"]
  769e97f4_3598_dfb3_d867_79026059841d -->|method| 3fcfed19_39b0_b31b_8ad4_7110c595f75b

Relationship Graph

Source Code

tests/api_resources/beta/messages/test_batches.py lines 454–884

class TestAsyncBatches:
    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(self, async_client: AsyncAnthropic) -> None:
        batch = await async_client.beta.messages.batches.create(
            requests=[
                {
                    "custom_id": "my-custom-id-1",
                    "params": {
                        "max_tokens": 1024,
                        "messages": [
                            {
                                "content": "Hello, world",
                                "role": "user",
                            }
                        ],
                        "model": "claude-opus-4-6",
                    },
                }
            ],
        )
        assert_matches_type(BetaMessageBatch, batch, path=["response"])

    @pytest.mark.skip(reason="prism validates based on the non-beta endpoint")
    @parametrize
    async def test_method_create_with_all_params(self, async_client: AsyncAnthropic) -> None:
        batch = await async_client.beta.messages.batches.create(
            requests=[
                {
                    "custom_id": "my-custom-id-1",
                    "params": {
                        "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",

Frequently Asked Questions

What is the TestAsyncBatches class?
TestAsyncBatches is a class in the anthropic-sdk-python codebase, defined in tests/api_resources/beta/messages/test_batches.py.
Where is TestAsyncBatches defined?
TestAsyncBatches is defined in tests/api_resources/beta/messages/test_batches.py at line 454.
What does TestAsyncBatches extend?
TestAsyncBatches extends BetaMessageBatch, BetaDeletedMessageBatch.

Analyze Your Own Codebase

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

Try Supermodel Free