From eeb5698e753f128747c8df2ea46c691d80c8d90d Mon Sep 17 00:00:00 2001 From: Samuel Colvin Date: Tue, 6 Feb 2018 17:01:55 +0000 Subject: [PATCH] funky test with create_model --- tests/test_create_model.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_create_model.py b/tests/test_create_model.py index ff52c30..185bbd9 100644 --- a/tests/test_create_model.py +++ b/tests/test_create_model.py @@ -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'}}