MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / test_directly_nested_model

Function test_directly_nested_model

tests/test_models.py:40–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38
39
40def test_directly_nested_model() -> None:
41 class NestedModel(BaseModel):
42 nested: BasicModel
43
44 m = NestedModel.construct(nested={"foo": "Foo!"})
45 assert m.nested.foo == "Foo!"
46
47 # mismatched types
48 m = NestedModel.construct(nested="hello!")
49 assert cast(Any, m.nested) == "hello!"
50
51
52def test_optional_nested_model() -> None:

Callers

nothing calls this directly

Calls 1

constructMethod · 0.45

Tested by

no test coverage detected