MCPcopy
hub / github.com/pydantic/pydantic / test_extra_allowed

Function test_extra_allowed

tests/test_main.py:370–381  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

368
369
370def test_extra_allowed():
371 class Model(BaseModel):
372 model_config = ConfigDict(extra='allow')
373 a: float
374
375 model = Model(a=0.2, b=0.1)
376 assert model.b == 0.1
377
378 assert not hasattr(model, 'c')
379 model.c = 1
380 assert hasattr(model, 'c')
381 assert model.c == 1
382
383
384def test_reassign_instance_method_with_extra_allow():

Callers

nothing calls this directly

Calls 1

ModelClass · 0.70

Tested by

no test coverage detected