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

test_extra_properties() — anthropic-sdk-python Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  f4f60587_1b29_a41e_bd4e_131a671fc9dd["test_extra_properties()"]
  7872e60b_4210_5600_119f_c5d08c52091e["test_models.py"]
  f4f60587_1b29_a41e_bd4e_131a671fc9dd -->|defined in| 7872e60b_4210_5600_119f_c5d08c52091e
  style f4f60587_1b29_a41e_bd4e_131a671fc9dd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_models.py lines 940–963

def test_extra_properties() -> None:
    class Item(BaseModel):
        prop: int

    class Model(BaseModel):
        __pydantic_extra__: Dict[str, Item] = Field(init=False)  # pyright: ignore[reportIncompatibleVariableOverride]

        other: str

        if TYPE_CHECKING:

            def __getattr__(self, attr: str) -> Item: ...

    model = construct_type(
        type_=Model,
        value={
            "a": {"prop": 1},
            "other": "foo",
        },
    )
    assert isinstance(model, Model)
    assert model.a.prop == 1
    assert isinstance(model.a, Item)
    assert model.other == "foo"

Subdomains

Frequently Asked Questions

What does test_extra_properties() do?
test_extra_properties() is a function in the anthropic-sdk-python codebase, defined in tests/test_models.py.
Where is test_extra_properties() defined?
test_extra_properties() is defined in tests/test_models.py at line 940.

Analyze Your Own Codebase

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

Try Supermodel Free