Skip to content

Commit 0691b12

Browse files
committed
Add tests for error cases
1 parent e655936 commit 0691b12

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/test_converters/test_combined_parser.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ def test_converter(date_string, expected):
4040
assert repr(Undate.parse(date_string, "omnibus")) == repr(expected)
4141

4242

43+
def test_parse_errors():
44+
# empty string not supported
45+
with pytest.raises(ValueError, match="not supported"):
46+
Undate.parse("", "omnibus")
47+
48+
with pytest.raises(ValueError, match="not in a recognized date format"):
49+
Undate.parse("Monday 2023", "omnibus")
50+
51+
4352
def test_no_serialize():
4453
with pytest.raises(ValueError, match="does not support"):
4554
Undate("2022").format("omnibus")

0 commit comments

Comments
 (0)