TestBatches Class — anthropic-sdk-python Architecture
Architecture documentation for the TestBatches class in test_batches.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD 4fd27e2e_c95e_1ba6_4183_6ea591b00faa["TestBatches"] f922c9c7_4662_64d5_2ca5_4c99386cbece["BetaMessageBatch"] 4fd27e2e_c95e_1ba6_4183_6ea591b00faa -->|extends| f922c9c7_4662_64d5_2ca5_4c99386cbece c40945ef_e03b_6b03_f6ae_8fc2dca315da["BetaDeletedMessageBatch"] 4fd27e2e_c95e_1ba6_4183_6ea591b00faa -->|extends| c40945ef_e03b_6b03_f6ae_8fc2dca315da 8338a118_0daa_4bed_30d9_2d313e1f3766["test_batches.py"] 4fd27e2e_c95e_1ba6_4183_6ea591b00faa -->|defined in| 8338a118_0daa_4bed_30d9_2d313e1f3766 68c7c786_73bd_6fa0_a552_d7c0b9059c88["test_method_create()"] 4fd27e2e_c95e_1ba6_4183_6ea591b00faa -->|method| 68c7c786_73bd_6fa0_a552_d7c0b9059c88 169ccc96_de26_1819_7693_61f15dd5aa11["test_method_create_with_all_params()"] 4fd27e2e_c95e_1ba6_4183_6ea591b00faa -->|method| 169ccc96_de26_1819_7693_61f15dd5aa11 3ab00ba6_2509_f672_486a_c793b9fd9463["test_raw_response_create()"] 4fd27e2e_c95e_1ba6_4183_6ea591b00faa -->|method| 3ab00ba6_2509_f672_486a_c793b9fd9463 4e7e5727_24c3_26ad_3e88_88d1db075bf8["test_streaming_response_create()"] 4fd27e2e_c95e_1ba6_4183_6ea591b00faa -->|method| 4e7e5727_24c3_26ad_3e88_88d1db075bf8 86f558a1_3aec_9352_3f14_ff71fc3c526b["test_method_retrieve()"] 4fd27e2e_c95e_1ba6_4183_6ea591b00faa -->|method| 86f558a1_3aec_9352_3f14_ff71fc3c526b 17174e15_0291_ba12_7953_ba2c45fe96da["test_method_retrieve_with_all_params()"] 4fd27e2e_c95e_1ba6_4183_6ea591b00faa -->|method| 17174e15_0291_ba12_7953_ba2c45fe96da 764f1e03_afa8_07a7_62a0_5a8e75231a96["test_raw_response_retrieve()"] 4fd27e2e_c95e_1ba6_4183_6ea591b00faa -->|method| 764f1e03_afa8_07a7_62a0_5a8e75231a96 d4307fc0_7f05_1164_57ca_702e3e7f9784["test_streaming_response_retrieve()"] 4fd27e2e_c95e_1ba6_4183_6ea591b00faa -->|method| d4307fc0_7f05_1164_57ca_702e3e7f9784 7b517340_09e0_0581_80dd_a2d2dd3e32e4["test_path_params_retrieve()"] 4fd27e2e_c95e_1ba6_4183_6ea591b00faa -->|method| 7b517340_09e0_0581_80dd_a2d2dd3e32e4 062bb04c_c1e2_5ccd_ca4e_ed3635d411c7["test_method_list()"] 4fd27e2e_c95e_1ba6_4183_6ea591b00faa -->|method| 062bb04c_c1e2_5ccd_ca4e_ed3635d411c7 fdf152a7_5014_1bb8_21a2_eb80bceef2e4["test_method_list_with_all_params()"] 4fd27e2e_c95e_1ba6_4183_6ea591b00faa -->|method| fdf152a7_5014_1bb8_21a2_eb80bceef2e4
Relationship Graph
Source Code
tests/api_resources/beta/messages/test_batches.py lines 24–451
class TestBatches:
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
@pytest.mark.skip(reason="prism validates based on the non-beta endpoint")
@parametrize
def test_method_create(self, client: Anthropic) -> None:
batch = 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
def test_method_create_with_all_params(self, client: Anthropic) -> None:
batch = 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",
"tool_configuration": {
"allowed_tools": ["string"],
Domain
Source
Frequently Asked Questions
What is the TestBatches class?
TestBatches is a class in the anthropic-sdk-python codebase, defined in tests/api_resources/beta/messages/test_batches.py.
Where is TestBatches defined?
TestBatches is defined in tests/api_resources/beta/messages/test_batches.py at line 24.
What does TestBatches extend?
TestBatches extends BetaMessageBatch, BetaDeletedMessageBatch.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free