mirror of
https://github.com/kennethreitz/pydantic.git
synced 2026-06-05 23:00:18 +00:00
funky test with create_model
This commit is contained in:
@@ -73,3 +73,12 @@ def test_inheritance_validators():
|
||||
assert model().a == 'cake'
|
||||
with pytest.raises(ValidationError):
|
||||
model(a='something else')
|
||||
|
||||
|
||||
def test_funky_name():
|
||||
model = create_model('FooModel', **{'this-is-funky': (int, ...)})
|
||||
m = model(**{'this-is-funky': '123'})
|
||||
assert m.dict() == {'this-is-funky': 123}
|
||||
with pytest.raises(ValidationError) as exc_info:
|
||||
model()
|
||||
assert exc_info.value.errors_dict == {'this-is-funky': {'error_msg': 'field required', 'error_type': 'Missing'}}
|
||||
|
||||
Reference in New Issue
Block a user