MCPcopy
hub / github.com/pydantic/pydantic / test_assign_extra_no_validate

Function test_assign_extra_no_validate

tests/test_main.py:340–347  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

338
339
340def 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
350def test_assign_extra_validate():

Callers

nothing calls this directly

Calls 1

ModelClass · 0.70

Tested by

no test coverage detected