MCPcopy
hub / github.com/pydantic/pydantic / test_private_attribute_nested

Function test_private_attribute_nested

tests/test_private_attributes.py:55–65  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

53
54
55def test_private_attribute_nested():
56 class SubModel(BaseModel):
57 _foo = PrivateAttr(42)
58 x: int
59
60 class Model(BaseModel):
61 y: int
62 sub: SubModel
63
64 m = Model(y=1, sub={'x': 2})
65 assert m.sub._foo == 42
66
67
68def test_private_attribute_factory():

Callers

nothing calls this directly

Calls 1

ModelClass · 0.70

Tested by

no test coverage detected