Skip to content

Commit 4e8c5b7

Browse files
authored
Merge pull request #17 from grumBit/Allow-suffixes-to-last-day-of-week
Allow suffixes to last day of week
2 parents ad81017 + 688cc88 commit 4e8c5b7

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

RELEASENOTES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Release History
22

3+
### v1.1.9 [2024-02-01]
4+
5+
- Fixes;
6+
- [Does not support "last day of the month" suffixes](https://github.com/grumBit/aws_cron_expression_validator/issues/12#issuecomment-1920567609)
7+
38
### v1.1.8 [2024-02-01]
49

510
- Fixes;

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "aws_cron_expression_validator"
7-
version = "1.1.8"
7+
version = "1.1.9"
88
authors = [
99
{ name="Graham Coster", email="bitjugglers@gmail.com" },
1010
]

src/aws_cron_expression_validator/validator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ def month_regex(cls):
136136
@classmethod
137137
def day_of_week_regex(cls):
138138
range_list = cls.list_range_regex(cls.day_of_week_values)
139-
return rf"^({range_list}|\*|\?|{cls.day_of_week_values}L|L|{cls.day_of_week_hash})$" # values , - * ? L #
139+
return rf"^({range_list}|\*|\?|{cls.day_of_week_values}L|L|L-[1-7]|{cls.day_of_week_hash})$"
140+
# values , - * ? L #
140141

141142
@classmethod
142143
def year_regex(cls):

tests/aws_cron_expression_validator/test_validator.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def test_month_regex(self):
129129

130130
def test_day_of_week_regex(self):
131131
given_regex = validator.AWSCronExpressionValidator.day_of_week_regex()
132-
given_valid_matches = ["*", "1", "5", "7", "MON", "?", "L", "5L", "MONL", "3#2", "MON-FRI"]
132+
given_valid_matches = ["*", "1", "5", "7", "MON", "?", "L", "5L", "MONL", "3#2", "MON-FRI", "L-1", "L-7"]
133133
given_invalid_matches = [
134134
"Monday",
135135
"0",
@@ -138,6 +138,9 @@ def test_day_of_week_regex(self):
138138
"?5",
139139
"5?",
140140
"5-L",
141+
"L-0",
142+
"L-8",
143+
"L-",
141144
"L5",
142145
"#",
143146
"0#2",
@@ -229,6 +232,8 @@ def test_validator(self):
229232
"30 0 1 JAN-APR,JUL-OCT/2,DEC ? *",
230233
"15 10 ? * L 2019-2022",
231234
"15 10 ? * 6L 2019-2022",
235+
"15 10 ? * FRIL 2019-2022",
236+
"15 10 ? * L-2 2019-2022",
232237
]
233238

234239
invalid_expression_exceptions = [
@@ -246,6 +251,7 @@ def test_validator(self):
246251
("15/30 10 * * ? 2400", validator.AWSCronExpressionYearError),
247252
("0 9 ? * ? *", validator.AWSCronExpressionError),
248253
("0 18 3L * ? *", validator.AWSCronExpressionDayOfMonthError),
254+
("0 18 L-3 * ? *", validator.AWSCronExpressionDayOfMonthError),
249255
("0 1-7/2,11-23/2, * * ? *", validator.AWSCronExpressionHourError),
250256
]
251257

0 commit comments

Comments
 (0)