Skip to content

Commit 8b07c46

Browse files
author
MarcoGorelli
committed
fixup
1 parent 9dc3f7d commit 8b07c46

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

pandas/tests/tools/test_to_datetime.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,7 +2056,10 @@ def test_to_datetime_iso8601_fails(self, input, format, exact):
20562056
# `format` is longer than the string, so this fails regardless of `exact`
20572057
with pytest.raises(
20582058
ValueError,
2059-
match=rf"time data '{input}' does not match format '{format}'",
2059+
match=(
2060+
rf"time data '{input}' does not match format "
2061+
rf"\'{format}\' \((match|search)\) at position 0"
2062+
),
20602063
):
20612064
to_datetime(input, format=format, exact=exact)
20622065

@@ -2075,7 +2078,7 @@ def test_to_datetime_iso8601_exact_fails(self, input, format):
20752078
# `format` is shorter than the date string, so only fails with `exact=True`
20762079
with pytest.raises(
20772080
ValueError,
2078-
match="unconverted data remains: |does not match format",
2081+
match="(unconverted data remains: |does not match format).* at position 0",
20792082
):
20802083
to_datetime(input, format=format)
20812084

@@ -2111,7 +2114,10 @@ def test_to_datetime_iso8601_separator(self, input, format):
21112114
# https://github.com/pandas-dev/pandas/issues/12649
21122115
with pytest.raises(
21132116
ValueError,
2114-
match=rf"time data \'{input}\' does not match format '{format}'",
2117+
match=(
2118+
rf"time data '{input}' does not match format "
2119+
rf"'{format}' \(match\) at position 0"
2120+
),
21152121
):
21162122
to_datetime(input, format=format)
21172123

@@ -2666,7 +2672,7 @@ def test_day_not_in_month_raise(self, cache):
26662672

26672673
@pytest.mark.parametrize("arg", ["2015-02-29", "2015-02-32", "2015-04-31"])
26682674
def test_day_not_in_month_raise_value(self, cache, arg):
2669-
msg = "day is out of range for month|unconverted data remains"
2675+
msg = "(day is out of range for month|unconverted data remains).* at position 0"
26702676
with pytest.raises(ValueError, match=msg):
26712677
to_datetime(arg, errors="raise", format="%Y-%m-%d", cache=cache)
26722678

0 commit comments

Comments
 (0)