Home / Function/ test_tracks_tool_input_type_alias_is_up_to_date() — anthropic-sdk-python Function Reference

test_tracks_tool_input_type_alias_is_up_to_date() — anthropic-sdk-python Function Reference

Architecture documentation for the test_tracks_tool_input_type_alias_is_up_to_date() function in test_beta_messages.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  509ea305_685b_b7a8_f132_7c4702dc966a["test_tracks_tool_input_type_alias_is_up_to_date()"]
  3c862ef1_541a_a7b0_64a0_4f89aa44af7c["test_beta_messages.py"]
  509ea305_685b_b7a8_f132_7c4702dc966a -->|defined in| 3c862ef1_541a_a7b0_64a0_4f89aa44af7c
  style 509ea305_685b_b7a8_f132_7c4702dc966a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/lib/streaming/test_beta_messages.py lines 412–444

def test_tracks_tool_input_type_alias_is_up_to_date() -> None:
    # only run this on Pydantic v2
    if PYDANTIC_V1:
        pytest.skip("This test is only applicable for Pydantic v2")
    from typing import get_args

    from pydantic import BaseModel

    from anthropic.types.beta.beta_content_block import BetaContentBlock

    # Get the content block union type
    content_block_union = get_args(BetaContentBlock)[0]

    # Get all types from BetaContentBlock union
    content_block_types = get_args(content_block_union)

    # Types that should have an input property
    types_with_input: Set[Any] = set()

    # Check each type to see if it has an input property in its model_fields
    for block_type in content_block_types:
        if issubclass(block_type, BaseModel) and "input" in block_type.model_fields:
            types_with_input.add(block_type)

    # Get the types included in TRACKS_TOOL_INPUT
    tracked_types = TRACKS_TOOL_INPUT

    # Make sure all types with input are tracked
    for block_type in types_with_input:
        assert block_type in tracked_types, (
            f"ContentBlock type {block_type.__name__} has an input property, "
            f"but is not included in TRACKS_TOOL_INPUT. You probably need to update the TRACKS_TOOL_INPUT type alias."
        )

Subdomains

Frequently Asked Questions

What does test_tracks_tool_input_type_alias_is_up_to_date() do?
test_tracks_tool_input_type_alias_is_up_to_date() is a function in the anthropic-sdk-python codebase, defined in tests/lib/streaming/test_beta_messages.py.
Where is test_tracks_tool_input_type_alias_is_up_to_date() defined?
test_tracks_tool_input_type_alias_is_up_to_date() is defined in tests/lib/streaming/test_beta_messages.py at line 412.

Analyze Your Own Codebase

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

Try Supermodel Free