TestMessages Class — anthropic-sdk-python Architecture
Architecture documentation for the TestMessages class in test_messages.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD 2636caa4_a35b_502e_80af_e3973f39b3bf["TestMessages"] 01beb2f6_442c_779e_7c57_22078b50dcf4["Message"] 2636caa4_a35b_502e_80af_e3973f39b3bf -->|extends| 01beb2f6_442c_779e_7c57_22078b50dcf4 b1b6ca15_8f4d_07a7_bcea_2f38fa0417f4["MessageTokensCount"] 2636caa4_a35b_502e_80af_e3973f39b3bf -->|extends| b1b6ca15_8f4d_07a7_bcea_2f38fa0417f4 5e472438_e610_3036_dbd4_fe8abc316021["test_messages.py"] 2636caa4_a35b_502e_80af_e3973f39b3bf -->|defined in| 5e472438_e610_3036_dbd4_fe8abc316021 6586f8cd_f695_0148_b291_fa2ac5e352ff["test_method_create_overload_1()"] 2636caa4_a35b_502e_80af_e3973f39b3bf -->|method| 6586f8cd_f695_0148_b291_fa2ac5e352ff 2368d180_bb43_8288_743b_6633f8159d13["test_method_create_with_all_params_overload_1()"] 2636caa4_a35b_502e_80af_e3973f39b3bf -->|method| 2368d180_bb43_8288_743b_6633f8159d13 0b933403_197c_ca8b_ceed_ec2286147c58["test_raw_response_create_overload_1()"] 2636caa4_a35b_502e_80af_e3973f39b3bf -->|method| 0b933403_197c_ca8b_ceed_ec2286147c58 eeae20b2_5e7c_cf6e_a2b4_2e9647eebb41["test_streaming_response_create_overload_1()"] 2636caa4_a35b_502e_80af_e3973f39b3bf -->|method| eeae20b2_5e7c_cf6e_a2b4_2e9647eebb41 79598992_97f9_0ab6_98c1_e8ef1b46f105["test_method_create_overload_2()"] 2636caa4_a35b_502e_80af_e3973f39b3bf -->|method| 79598992_97f9_0ab6_98c1_e8ef1b46f105 19ab12ae_622e_cd5f_5f21_585257ed0cd8["test_method_create_with_all_params_overload_2()"] 2636caa4_a35b_502e_80af_e3973f39b3bf -->|method| 19ab12ae_622e_cd5f_5f21_585257ed0cd8 a416a694_8210_2103_bf67_84e76e6c7543["test_raw_response_create_overload_2()"] 2636caa4_a35b_502e_80af_e3973f39b3bf -->|method| a416a694_8210_2103_bf67_84e76e6c7543 7cf93796_f70d_ec54_64e1_5ee5aefa72d1["test_streaming_response_create_overload_2()"] 2636caa4_a35b_502e_80af_e3973f39b3bf -->|method| 7cf93796_f70d_ec54_64e1_5ee5aefa72d1 bdc6c2f1_8b6c_3d31_8ab5_ed1664393a50["test_deprecated_model_warning()"] 2636caa4_a35b_502e_80af_e3973f39b3bf -->|method| bdc6c2f1_8b6c_3d31_8ab5_ed1664393a50 a1204879_b45b_7852_f675_6ef572b9ca1a["test_method_count_tokens()"] 2636caa4_a35b_502e_80af_e3973f39b3bf -->|method| a1204879_b45b_7852_f675_6ef572b9ca1a fc8c1e85_ee5a_2687_c732_8dd38114ab49["test_method_count_tokens_with_all_params()"] 2636caa4_a35b_502e_80af_e3973f39b3bf -->|method| fc8c1e85_ee5a_2687_c732_8dd38114ab49
Relationship Graph
Source Code
tests/api_resources/test_messages.py lines 21–409
class TestMessages:
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
@parametrize
def test_method_create_overload_1(self, client: Anthropic) -> None:
message = 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
def test_method_create_with_all_params_overload_1(self, client: Anthropic) -> None:
message = 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",
"cache_control": {
"type": "ephemeral",
Domain
Defined In
Extends
Source
Frequently Asked Questions
What is the TestMessages class?
TestMessages is a class in the anthropic-sdk-python codebase, defined in tests/api_resources/test_messages.py.
Where is TestMessages defined?
TestMessages is defined in tests/api_resources/test_messages.py at line 21.
What does TestMessages extend?
TestMessages extends Message, MessageTokensCount.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free