MCPcopy
hub / github.com/pydantic/pydantic / test_invalid_extra

Function test_invalid_extra

tests/test_config.py:465–482  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

463
464
465def test_invalid_extra():
466 ConfigDict(extra='invalid-value')
467 extra_error = re.escape('Invalid extra_behavior: `invalid-value`')
468 config_dict = {'extra': 'invalid-value'}
469
470 with pytest.raises(SchemaError, match=extra_error):
471
472 class MyModel(BaseModel):
473 model_config = config_dict
474
475 with pytest.raises(SchemaError, match=extra_error):
476 create_model('MyCreatedModel', __config__=config_dict)
477
478 with pytest.raises(SchemaError, match=extra_error):
479
480 @pydantic_dataclass(config=config_dict)
481 class MyDataclass:
482 pass
483
484
485def test_invalid_config_keys():

Callers

nothing calls this directly

Calls 2

ConfigDictClass · 0.90
create_modelFunction · 0.90

Tested by

no test coverage detected