Home / File/ test_messages.py — anthropic-sdk-python Source File

test_messages.py — anthropic-sdk-python Source File

Architecture documentation for test_messages.py, a python file in the anthropic-sdk-python codebase. 8 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  1c8a15e3_0d33_599b_c076_58c2e38c4fe0["test_messages.py"]
  bb0af148_44a9_df40_49c4_0fa6ceb5a403["os"]
  1c8a15e3_0d33_599b_c076_58c2e38c4fe0 --> bb0af148_44a9_df40_49c4_0fa6ceb5a403
  89ddcdd7_3ae1_4c7b_41bb_9f1e25f16875["typing"]
  1c8a15e3_0d33_599b_c076_58c2e38c4fe0 --> 89ddcdd7_3ae1_4c7b_41bb_9f1e25f16875
  cde8421b_93c7_41e4_d69d_2a3f1bade2f2["pytest"]
  1c8a15e3_0d33_599b_c076_58c2e38c4fe0 --> cde8421b_93c7_41e4_d69d_2a3f1bade2f2
  21de8837_7dae_989e_fdbb_1415c0770d90["pydantic"]
  1c8a15e3_0d33_599b_c076_58c2e38c4fe0 --> 21de8837_7dae_989e_fdbb_1415c0770d90
  d10c5377_2939_0f0b_cc44_8759393f2853["anthropic"]
  1c8a15e3_0d33_599b_c076_58c2e38c4fe0 --> d10c5377_2939_0f0b_cc44_8759393f2853
  cf46c35e_ae7e_a652_f32b_5dd703f4d658["utils.py"]
  1c8a15e3_0d33_599b_c076_58c2e38c4fe0 --> cf46c35e_ae7e_a652_f32b_5dd703f4d658
  08e9c9e7_d7f9_615f_5837_b3de69122e37["assert_matches_type"]
  1c8a15e3_0d33_599b_c076_58c2e38c4fe0 --> 08e9c9e7_d7f9_615f_5837_b3de69122e37
  02abf1f6_b512_32df_c4f5_940df96192d8["anthropic.types.beta"]
  1c8a15e3_0d33_599b_c076_58c2e38c4fe0 --> 02abf1f6_b512_32df_c4f5_940df96192d8
  style 1c8a15e3_0d33_599b_c076_58c2e38c4fe0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

import os
from typing import Any, cast

import pytest
import pydantic

from anthropic import Anthropic, AsyncAnthropic
from tests.utils import assert_matches_type
from anthropic.types.beta import (
    BetaMessage,
    BetaMessageTokensCount,
)

base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")


class TestMessages:
    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_overload_1(self, client: Anthropic) -> None:
        message = 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
    def test_method_create_with_all_params_overload_1(self, client: Anthropic) -> None:
        message = 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",
                    }
                ],
            },
// ... (1079 more lines)

Subdomains

Dependencies

Frequently Asked Questions

What does test_messages.py do?
test_messages.py is a source file in the anthropic-sdk-python codebase, written in python. It belongs to the AnthropicClient domain, Authentication subdomain.
What does test_messages.py depend on?
test_messages.py imports 8 module(s): anthropic, anthropic.types.beta, assert_matches_type, os, pydantic, pytest, typing, utils.py.
Where is test_messages.py in the architecture?
test_messages.py is located at tests/api_resources/beta/test_messages.py (domain: AnthropicClient, subdomain: Authentication, directory: tests/api_resources/beta).

Analyze Your Own Codebase

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

Try Supermodel Free