File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -214,11 +214,11 @@ def _parse_iso8601_interval(text: str) -> _Interval:
214214 first , last = text .split ("/" )
215215 start = end = duration = None
216216
217- if first [0 ] == "P" :
217+ if first [0 : 1 ] == "P" :
218218 # duration/end
219219 duration = parse_iso8601 (first )
220220 end = parse_iso8601 (last )
221- elif last [0 ] == "P" :
221+ elif last [0 : 1 ] == "P" :
222222 # start/duration
223223 start = parse_iso8601 (first )
224224 duration = parse_iso8601 (last )
Original file line number Diff line number Diff line change @@ -660,6 +660,16 @@ def test_invalid():
660660 with pytest .raises (ParserError ):
661661 parse (text )
662662
663+ text = "/2012"
664+
665+ with pytest .raises (ParserError ):
666+ parse (text )
667+
668+ text = "2012/"
669+
670+ with pytest .raises (ParserError ):
671+ parse (text )
672+
663673
664674def test_exif_edge_case ():
665675 text = "2016:12:26 15:45:28"
You can’t perform that action at this time.
0 commit comments