8000 "date-time" not full supported · Issue #115 · horejsek/python-fastjsonschema · GitHub
[go: up one dir, main page]

Skip to content
"date-time" not full supported #115
@jedie

Description

@jedie

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:

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0