Skip to content

Commit a15145d

Browse files
committed
fix: Fix regex
1 parent a38aa42 commit a15145d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

policyengine/utils/reforms.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import re
12
from pydantic import (
23
RootModel,
34
field_validator,
@@ -56,8 +57,8 @@ def validate_dates(
5657
date_range_keys_re = r"^\d{4}-\d{2}-\d{2}\.\d{4}-\d{2}-\d{2}$"
5758

5859
for key in value.keys():
59-
if not year_keys_re.match(key) and not date_range_keys_re.match(
60-
key
60+
if not re.match(year_keys_re, key) and not re.match(
61+
date_range_keys_re, key
6162
):
6263
raise ValueError(
6364
f"Key '{key}' must be a single year (YYYY) or a date range (YYYY-MM-DD.YYYY-MM-DD)"

tests/utils/test_reforms.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
ParameterChangeDict,
77
ParametricReform,
88
ParameterChangeValue,
9-
ParameterChangePeriod,
109
)
1110

1211

0 commit comments

Comments
 (0)