Skip to content

Commit a29a5a4

Browse files
committed
Test error handling in gregorian converter parse method
1 parent e4c468d commit a29a5a4

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

tests/test_converters/test_calendars/test_gregorian/test_gregorian_converter.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import pytest
2+
3+
14
from undate.date import DatePrecision
25
from undate.undate import Undate, Calendar
36
from undate.converters.calendars import GregorianDateConverter
@@ -65,3 +68,10 @@ def test_parse(self):
6568
assert date.calendar == Calendar.GREGORIAN
6669
assert date.precision == DatePrecision.YEAR
6770
assert date.label == date_str
71+
72+
def test_parse_errors(self):
73+
with pytest.raises(ValueError, match="empty string is not supported"):
74+
GregorianDateConverter().parse("")
75+
76+
with pytest.raises(ValueError, match="Could not parse"):
77+
GregorianDateConverter().parse("Foo 1920")

0 commit comments

Comments
 (0)