test_nested_union_of_mixed_types() — anthropic-sdk-python Function Reference
Architecture documentation for the test_nested_union_of_mixed_types() function in test_models.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD 54aa820d_3c23_b9e1_e100_d2779e7bb282["test_nested_union_of_mixed_types()"] 7872e60b_4210_5600_119f_c5d08c52091e["test_models.py"] 54aa820d_3c23_b9e1_e100_d2779e7bb282 -->|defined in| 7872e60b_4210_5600_119f_c5d08c52091e style 54aa820d_3c23_b9e1_e100_d2779e7bb282 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_models.py lines 237–252
def test_nested_union_of_mixed_types() -> None:
class Submodel1(BaseModel):
bar: bool
class Model(BaseModel):
foo: Union[Submodel1, Literal[True], Literal["CARD_HOLDER"]]
m = Model.construct(foo=True)
assert m.foo is True
m = Model.construct(foo="CARD_HOLDER")
assert m.foo == "CARD_HOLDER"
m = Model.construct(foo={"bar": False})
assert isinstance(m.foo, Submodel1)
assert m.foo.bar is False
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does test_nested_union_of_mixed_types() do?
test_nested_union_of_mixed_types() is a function in the anthropic-sdk-python codebase, defined in tests/test_models.py.
Where is test_nested_union_of_mixed_types() defined?
test_nested_union_of_mixed_types() is defined in tests/test_models.py at line 237.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free