File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -212,6 +212,10 @@ def _parse_iso8601_interval(text: str) -> _Interval:
212
212
raise ParserError ("Invalid interval" )
213
213
214
214
first , last = text .split ("/" )
215
+
216
+ if not first or not last :
217
+ raise ParserError ("Invalid interval." )
218
+
215
219
start = end = duration = None
216
220
217
221
if first [0 ] == "P" :
Original file line number Diff line number Diff line change @@ -293,6 +293,14 @@ def test_parse_duration_invalid():
293
293
parse ("P1Dasdfasdf" )
294
294
295
295
296
+ def test_parse_interval_invalid ():
297
+ with pytest .raises (ParserError ):
298
+ parse ("/no_start" )
299
+
300
+ with pytest .raises (ParserError ):
301
+ parse ("no_end/" )
302
+
303
+
296
304
def test_parse_duration_fraction_only_allowed_on_last_component ():
297
305
with pytest .raises (ParserError ):
298
306
parse ("P2Y3M4DT5.5H6M7S" )
You can’t perform that action at this time.
0 commit comments