MCPcopy
hub / github.com/pydantic/pydantic / AnnotatedPrivateFieldModel

Class AnnotatedPrivateFieldModel

tests/test_annotated.py:451–454  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

449
450def test_annotated_private_field_with_default():
451 class AnnotatedPrivateFieldModel(BaseModel):
452 _foo: Annotated[int, PrivateAttr(default=1)]
453 _bar: Annotated[str, 'hello']
454 _baz: 'Annotated[str, PrivateAttr(default=2)]'
455
456 model = AnnotatedPrivateFieldModel()
457 assert model._foo == 1

Calls 1

PrivateAttrFunction · 0.90