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:
212212 raise ParserError ("Invalid interval" )
213213
214214 first , last = text .split ("/" )
215+
216+ if not first or not last :
217+ raise ParserError ("Invalid interval." )
218+
215219 start = end = duration = None
216220
217221 if first [:1 ] == "P" :
Original file line number Diff line number Diff line change @@ -293,6 +293,14 @@ def test_parse_duration_invalid():
293293 parse ("P1Dasdfasdf" )
294294
295295
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+
296304def test_parse_duration_fraction_only_allowed_on_last_component ():
297305 with pytest .raises (ParserError ):
298306 parse ("P2Y3M4DT5.5H6M7S" )
You can’t perform that action at this time.
0 commit comments