-
-
Notifications
You must be signed in to change notification settings - Fork 71
Closed
Description
e.g.:
>>> import fastjsonschema
>>> fastjsonschema.validate({'type': 'string', 'format': 'date-time'},'2020-09-09T01:01:01+0100')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/jens/repos/python-fastjsonschema/fastjsonschema/__init__.py", line 113, in validate
return compile(definition, handlers, formats, use_default)(data)
File "<string>", line 8, in validate
fastjsonschema.exceptions.JsonSchemaValueException: data must be date-time
Support was added with: #7
But a later refactor seems to remove this.
And there is no test for it:
python-fastjsonschema/tests/test_format.py
Lines 9 to 19 in 32476cf
exc = JsonSchemaValueException('data must be date-time', value='{data}', name='data', definition='{definition}', rule='format') | |
@pytest.mark.parametrize('value, expected', [ | |
('', exc), | |
('bla', exc), | |
('2018-02-05T14:17:10.00', exc), | |
('2018-02-05T14:17:10.00Z\n', exc), | |
('2018-02-05T14:17:10.00Z', '2018-02-05T14:17:10.00Z'), | |
('2018-02-05T14:17:10Z', '2018-02-05T14:17:10Z'), | |
]) | |
def test_datetime(asserter, value, expected): | |
asserter({'type': 'string', 'format': 'date-time'}, value, expected) |
Metadata
Metadata
Assignees
Labels
No labels