@@ -23,7 +23,8 @@ def _check_non_match(self, regex: str, match: str):
2323 def test_slash_regex (self ):
2424 minute_values = r"(0?[0-9]|[1-5][0-9])" # [0]0-59
2525 given_regex = validator .AWSCronExpressionValidator .slash_regex (minute_values )
26- given_valid_matches = ["*/10" , "1/10" , "0/05" , "0/15" , "0/30" , "55/1" ]
26+ given_valid_matches = ["*/10" , "1/10" , "0/05" , "0/15" , "0/30" , "55/1" , "1-7/2" ]
27+
2728 given_invalid_matches = [
2829 "" ,
2930 "/" ,
@@ -44,15 +45,23 @@ def test_slash_regex(self):
4445 self ._then_matches (given_regex , given_valid_matches )
4546 self ._then_does_not_match (given_regex , given_invalid_matches )
4647
48+ def test_list_slash_regex (self ):
49+ given_regex = validator .AWSCronExpressionValidator .list_slash_regex (r"[B-Y]" )
50+ given_valid_matches = ["B" , "B/2,C-D/2" , "*/10,*/3" ]
51+ given_valid_matches = ["B/2" , "B/2,C/2" , "B/2,C/2,D/2" , "*/10,*/3" , "B,C/2,D/2" , "B/2,C,D/2" , "C/2,D-T/2" ]
52+ given_invalid_matches = ["*/10,*/3," ]
53+ self ._then_matches (given_regex , given_valid_matches )
54+ self ._then_does_not_match (given_regex , given_invalid_matches )
55+
4756 def test_range_regex (self ):
4857 given_regex = validator .AWSCronExpressionValidator .range_regex (r"[B-Y]" )
4958 given_valid_matches = ["B" , "*-D" , "D-*" , "B-Y" , "D-F" , "D-B" ]
5059 given_invalid_matches = ["*-*" , "*B" , "A-D" , "D-Z" , "B-C-D" , "" ]
5160 self ._then_matches (given_regex , given_valid_matches )
5261 self ._then_does_not_match (given_regex , given_invalid_matches )
5362
54- def test_list_regex (self ):
55- given_regex = validator .AWSCronExpressionValidator .list_regex (r"[B-Y]" )
63+ def test_list_range_regex (self ):
64+ given_regex = validator .AWSCronExpressionValidator .list_range_regex (r"[B-Y]" )
5665 given_valid_matches = ["D" , "D,F" , "F-D" , "D,F,C,J" , "D-F,J" , "B,D-F,J" , "D,F-J" , "*-R,X" , "R,X-*" , "*-R,T,X-*" ]
5766 given_invalid_matches = ["*,P" , "P,*,Q" , "Q-P,*" , "" , "D,F," , ",D,F" , "" ]
5867 self ._then_matches (given_regex , given_valid_matches )
@@ -120,15 +129,14 @@ def test_month_regex(self):
120129
121130 def test_day_of_week_regex (self ):
122131 given_regex = validator .AWSCronExpressionValidator .day_of_week_regex ()
123- given_valid_matches = ["*" , "1" , "5" , "7" , "MON" , "?" , "L" , "3#2" , "MON-FRI" ]
132+ given_valid_matches = ["*" , "1" , "5" , "7" , "MON" , "?" , "L" , "5L" , "MONL" , " 3#2" , "MON-FRI" ]
124133 given_invalid_matches = [
125134 "Monday" ,
126135 "0" ,
127136 "01" ,
128137 "8" ,
129138 "?5" ,
130139 "5?" ,
131- "5L" ,
132140 "5-L" ,
133141 "L5" ,
134142 "#" ,
@@ -182,6 +190,7 @@ def test_validator(self):
182190 valid_expressions = [
183191 "0 18 ? * MON-FRI *" ,
184192 "0 18 ? * L *" ,
193+ "0 18 ? * SATL *" ,
185194 "0 18 L * ? *" ,
186195 "0 18 31W * ? *" ,
187196 "0 10 * * ? *" ,
@@ -215,6 +224,11 @@ def test_validator(self):
215224 "0 11-23/4 ? * 2-6 *" ,
216225 "0 11-23/2 * * ? *" ,
217226 "0 0 1 1-12/3 ? *" ,
227+ "0 1-7/2,11-23/2 * * ? *" ,
228+ "0 1-7/2,11-23/2,10 * * ? *" ,
229+ "30 0 1 JAN-APR,JUL-OCT/2,DEC ? *" ,
230+ "15 10 ? * L 2019-2022" ,
231+ "15 10 ? * 6L 2019-2022" ,
218232 ]
219233
220234 invalid_expression_exceptions = [
@@ -231,6 +245,8 @@ def test_validator(self):
231245 ("0,5 07/12 ? * 1 2000-2200" , validator .AWSCronExpressionYearError ),
232246 ("15/30 10 * * ? 2400" , validator .AWSCronExpressionYearError ),
233247 ("0 9 ? * ? *" , validator .AWSCronExpressionError ),
248+ ("0 18 3L * ? *" , validator .AWSCronExpressionDayOfMonthError ),
249+ ("0 1-7/2,11-23/2, * * ? *" , validator .AWSCronExpressionHourError ),
234250 ]
235251
236252 for valid_expression in valid_expressions :
0 commit comments