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

test_list_nested_model() — anthropic-sdk-python Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

tests/test_models.py lines 54–70

def test_list_nested_model() -> None:
    class NestedModel(BaseModel):
        nested: List[BasicModel]

    m = NestedModel.construct(nested=[{"foo": "bar"}, {"foo": "2"}])
    assert m.nested is not None
    assert isinstance(m.nested, list)
    assert len(m.nested) == 2
    assert m.nested[0].foo == "bar"
    assert m.nested[1].foo == "2"

    # mismatched types
    m = NestedModel.construct(nested=True)
    assert cast(Any, m.nested) is True

    m = NestedModel.construct(nested=[False])
    assert cast(Any, m.nested) == [False]

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free