MCPcopy
hub / github.com/pydantic/pydantic / test_assign_extra_validate

Function test_assign_extra_validate

tests/test_main.py:350–357  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

348
349
350def test_assign_extra_validate():
351 class Model(BaseModel):
352 model_config = ConfigDict(validate_assignment=True)
353 a: float
354
355 model = Model(a=0.2)
356 with pytest.raises(ValidationError, match=r"b\s+Object has no attribute 'b'"):
357 model.b = 2
358
359
360def test_model_property_attribute_error():

Callers

nothing calls this directly

Calls 1

ModelClass · 0.70

Tested by

no test coverage detected