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

test_pydantic_default_field() — anthropic-sdk-python Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  7a1d6b8b_9719_4969_5961_e594b17496a7["test_pydantic_default_field()"]
  6d065906_49ba_5188_2c4a_08d599bd18f8["test_transform.py"]
  7a1d6b8b_9719_4969_5961_e594b17496a7 -->|defined in| 6d065906_49ba_5188_2c4a_08d599bd18f8
  5eb50e5f_8948_6af4_c03d_f10efd0687eb["transform()"]
  7a1d6b8b_9719_4969_5961_e594b17496a7 -->|calls| 5eb50e5f_8948_6af4_c03d_f10efd0687eb
  style 7a1d6b8b_9719_4969_5961_e594b17496a7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_transform.py lines 340–357

async def test_pydantic_default_field(use_async: bool) -> None:
    # should be excluded when defaults are used
    model = ModelWithDefaultField.construct()
    assert model.with_none_default is None
    assert model.with_str_default == "foo"
    assert cast(Any, await transform(model, Any, use_async)) == {}

    # should be included when the default value is explicitly given
    model = ModelWithDefaultField.construct(with_none_default=None, with_str_default="foo")
    assert model.with_none_default is None
    assert model.with_str_default == "foo"
    assert cast(Any, await transform(model, Any, use_async)) == {"with_none_default": None, "with_str_default": "foo"}

    # should be included when a non-default value is explicitly given
    model = ModelWithDefaultField.construct(with_none_default="bar", with_str_default="baz")
    assert model.with_none_default == "bar"
    assert model.with_str_default == "baz"
    assert cast(Any, await transform(model, Any, use_async)) == {"with_none_default": "bar", "with_str_default": "baz"}

Subdomains

Calls

Frequently Asked Questions

What does test_pydantic_default_field() do?
test_pydantic_default_field() is a function in the anthropic-sdk-python codebase, defined in tests/test_transform.py.
Where is test_pydantic_default_field() defined?
test_pydantic_default_field() is defined in tests/test_transform.py at line 340.
What does test_pydantic_default_field() call?
test_pydantic_default_field() calls 1 function(s): transform.

Analyze Your Own Codebase

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

Try Supermodel Free