From e8e34c887bf80971c0b398e8e8a590cf71b0bf32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jimmy=20M=C3=A5rdell?= Date: Mon, 2 Dec 2024 10:56:39 +0100 Subject: [PATCH] Fix date pattern regexp --- fastjsonschema/draft07.py | 2 +- tests/test_format.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/fastjsonschema/draft07.py b/fastjsonschema/draft07.py index 83e3af2..227525e 100644 --- a/fastjsonschema/draft07.py +++ b/fastjsonschema/draft07.py @@ -3,7 +3,7 @@ class CodeGeneratorDraft07(CodeGeneratorDraft06): FORMAT_REGEXS = dict(CodeGeneratorDraft06.FORMAT_REGEXS, **{ - 'date': r'^(?P\d{4})-(?P(0[1-9]|1[1-2]))-(?P(0[1-9]|[12]\d|3[01]))\Z', + 'date': r'^(?P\d{4})-(?P(0[1-9]|1[0-2]))-(?P(0[1-9]|[12]\d|3[01]))\Z', 'iri': r'^\w+:(\/?\/?)[^\s]+\Z', 'iri-reference': r'^(\w+:(\/?\/?))?[^#\\\s]*(#[^\\\s]*)?\Z', 'idn-email': r'^[^@]+@[^@]+\.[^@]+\Z', diff --git a/tests/test_format.py b/tests/test_format.py index 8dc388e..845d6c6 100644 --- a/tests/test_format.py +++ b/tests/test_format.py @@ -43,6 +43,7 @@ def test_hostname(asserter, value, expected): ('bla', exc), ('2018-2-5', exc), ('2018-02-05', '2018-02-05'), + ('2018-10-31', '2018-10-31'), ]) def test_date(asserter, value, expected): asserter({