MCPcopy
hub / github.com/pydantic/pydantic / test_create_model_private_attr

Function test_create_model_private_attr

tests/test_create_model.py:65–72  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

63
64
65def test_create_model_private_attr() -> None:
66 FooModel = create_model('FooModel', _priv1=int, _priv2=(int, PrivateAttr(default=2)))
67 assert set(FooModel.__private_attributes__) == {'_priv1', '_priv2'}
68
69 m = FooModel()
70 m._priv1 = 1
71 assert m._priv1 == 1
72 assert m._priv2 == 2
73
74
75def test_create_model_pickle(create_module):

Callers

nothing calls this directly

Calls 2

create_modelFunction · 0.90
PrivateAttrFunction · 0.90

Tested by

no test coverage detected