()
| 338 | |
| 339 | |
| 340 | def test_assign_extra_no_validate(): |
| 341 | class Model(BaseModel): |
| 342 | model_config = ConfigDict(validate_assignment=True) |
| 343 | a: float |
| 344 | |
| 345 | model = Model(a=0.2) |
| 346 | with pytest.raises(ValidationError, match=r"b\s+Object has no attribute 'b'"): |
| 347 | model.b = 2 |
| 348 | |
| 349 | |
| 350 | def test_assign_extra_validate(): |