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

test_transform.py — anthropic-sdk-python Source File

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

File python AnthropicClient SyncAPI 4 imports 12 functions

Entity Profile

Dependency Diagram

graph LR
  f13a5b42_c05a_948e_30ef_06fc0a2c8ed3["test_transform.py"]
  30408ccb_01be_d829_7c8f_547c414bd1bb["copy"]
  f13a5b42_c05a_948e_30ef_06fc0a2c8ed3 --> 30408ccb_01be_d829_7c8f_547c414bd1bb
  cde8421b_93c7_41e4_d69d_2a3f1bade2f2["pytest"]
  f13a5b42_c05a_948e_30ef_06fc0a2c8ed3 --> cde8421b_93c7_41e4_d69d_2a3f1bade2f2
  8cc1f0ad_0f79_35fa_324c_9980bd002940["inline_snapshot"]
  f13a5b42_c05a_948e_30ef_06fc0a2c8ed3 --> 8cc1f0ad_0f79_35fa_324c_9980bd002940
  e6590b00_6d1d_2e74_b4a4_ea70e807c934["anthropic.lib._parse._transform"]
  f13a5b42_c05a_948e_30ef_06fc0a2c8ed3 --> e6590b00_6d1d_2e74_b4a4_ea70e807c934
  style f13a5b42_c05a_948e_30ef_06fc0a2c8ed3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from copy import deepcopy

import pytest
from inline_snapshot import snapshot

from anthropic.lib._parse._transform import transform_schema


def test_ref_schema():
    schema = {"$ref": "#/components/schemas/SomeSchema"}
    result = transform_schema(schema)
    assert result == snapshot({"$ref": "#/components/schemas/SomeSchema"})


def test_anyof_schema():
    schema = {
        "anyOf": [
            {"type": "string"},
            {"type": "integer", "minimum": 1},
        ]
    }
    result = transform_schema(schema)
    assert result == snapshot(
        {
            "anyOf": [
                {"type": "string"},
                {
                    "type": "integer",
                    "description": "{minimum: 1}",
                },
            ]
        }
    )


def test_allof():
    schema = {
        "allOf": [
            {"type": "object", "properties": {"name": {"type": "string"}}},
            {"type": "object", "properties": {"age": {"type": "integer", "minimum": 0}}},
        ]
    }
    result = transform_schema(schema)
    assert result == snapshot(
        {
            "allOf": [
                {
                    "type": "object",
                    "properties": {"name": {"type": "string"}},
                    "additionalProperties": False,
                },
                {
                    "type": "object",
                    "properties": {"age": {"type": "integer", "description": "{minimum: 0}"}},
                    "additionalProperties": False,
                },
            ]
        }
    )

// ... (132 more lines)

Subdomains

Dependencies

  • anthropic.lib._parse._transform
  • copy
  • inline_snapshot
  • pytest

Frequently Asked Questions

What does test_transform.py do?
test_transform.py is a source file in the anthropic-sdk-python codebase, written in python. It belongs to the AnthropicClient domain, SyncAPI subdomain.
What functions are defined in test_transform.py?
test_transform.py defines 12 function(s): test_allof, test_anyof_schema, test_array_schema, test_boolean_schema, test_integer_schema_with_min_max_exclusive, test_null_schema, test_object_schema, test_original_schema_not_mutated, test_ref_schema, test_string_schema_with_format_and_default, and 2 more.
What does test_transform.py depend on?
test_transform.py imports 4 module(s): anthropic.lib._parse._transform, copy, inline_snapshot, pytest.
Where is test_transform.py in the architecture?
test_transform.py is located at tests/lib/_parse/test_transform.py (domain: AnthropicClient, subdomain: SyncAPI, directory: tests/lib/_parse).

Analyze Your Own Codebase

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

Try Supermodel Free