MCPcopy
hub / github.com/pydantic/pydantic / test_annotation_config

Function test_annotation_config

tests/test_aliases.py:121–129  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

119
120
121def test_annotation_config():
122 class Model(BaseModel):
123 b: float = Field(alias='foobar')
124 a: int = 10
125 _c: str
126
127 assert list(Model.model_fields.keys()) == ['b', 'a']
128 assert [f.alias for f in Model.model_fields.values()] == ['foobar', None]
129 assert Model(foobar='123').b == 123.0
130
131
132def test_pop_by_field_name():

Callers

nothing calls this directly

Calls 3

keysMethod · 0.80
valuesMethod · 0.80
ModelClass · 0.70

Tested by

no test coverage detected