def test_if_raises_exception_with_invalid_data_and_not_strict_schema(self):
class NotStrictSchema(marshmallow.Schema):
uuid_field = fields.UUID(required=True)
class Event(structures.Model):
class Meta:
schema = NotStrictSchema
type_name = 'Event'
data = '{"uuid_field": "not an uuid"}'
with pytest.raises(exceptions.DecodingError) as excinfo:
encoding.decode(type=Event, encoded_data=data)
assert str(excinfo.value) == (
"({'uuid_field': ['Not a valid UUID.']}, '')")
评论列表
文章目录