MCPcopy
hub / github.com/pydantic/pydantic / test_properties

Function test_properties

tests/test_deprecated.py:201–216  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

199
200
201def test_properties():
202 class XyProperty:
203 x = 4
204
205 @property
206 def y(self):
207 return '5'
208
209 class Model(BaseModel):
210 model_config = ConfigDict(from_attributes=True)
211 x: int
212 y: int
213
214 model = deprecated_from_orm(Model, XyProperty())
215 assert model.x == 4
216 assert model.y == 5
217
218
219@pytest.mark.parametrize('extra', ['ignore', 'forbid', 'allow'])

Callers

nothing calls this directly

Calls 2

deprecated_from_ormFunction · 0.85
XyPropertyClass · 0.85

Tested by

no test coverage detected