test_optional_list() — anthropic-sdk-python Function Reference
Architecture documentation for the test_optional_list() function in test_models.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD 8eb75c6a_de84_8870_6610_ada258d8c698["test_optional_list()"] 7872e60b_4210_5600_119f_c5d08c52091e["test_models.py"] 8eb75c6a_de84_8870_6610_ada258d8c698 -->|defined in| 7872e60b_4210_5600_119f_c5d08c52091e style 8eb75c6a_de84_8870_6610_ada258d8c698 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_models.py lines 203–219
def test_optional_list() -> None:
class Submodel(BaseModel):
name: str
class Model(BaseModel):
items: Optional[List[Submodel]]
m = Model.construct(items=None)
assert m.items is None
m = Model.construct(items=[])
assert m.items == []
m = Model.construct(items=[{"name": "Robert"}])
assert m.items is not None
assert len(m.items) == 1
assert m.items[0].name == "Robert"
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does test_optional_list() do?
test_optional_list() is a function in the anthropic-sdk-python codebase, defined in tests/test_models.py.
Where is test_optional_list() defined?
test_optional_list() is defined in tests/test_models.py at line 203.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free