diff --git a/pandas/tests/frame/test_block_internals.py b/pandas/tests/frame/test_block_internals.py index 47eb387abc8e8..25e66a0e1c03d 100644 --- a/pandas/tests/frame/test_block_internals.py +++ b/pandas/tests/frame/test_block_internals.py @@ -251,7 +251,7 @@ def f(dtype): f("float64") # 10822 - msg = "^Unknown datetime string format, unable to parse: aa, at position 0$" + msg = "^Unknown datetime string format, unable to parse: aa$" with pytest.raises(ValueError, match=msg): f("M8[ns]") diff --git a/pandas/tests/io/parser/test_parse_dates.py b/pandas/tests/io/parser/test_parse_dates.py index 386348c4bd687..532fcc5cd880c 100644 --- a/pandas/tests/io/parser/test_parse_dates.py +++ b/pandas/tests/io/parser/test_parse_dates.py @@ -507,8 +507,8 @@ def test_parse_multiple_delimited_dates_with_swap_warnings(): with pytest.raises( ValueError, match=( - r'^time data "31/05/2000" doesn\'t match format "%m/%d/%Y", ' - r"at position 1. You might want to try:" + r'^time data "31/05/2000" doesn\'t match format "%m/%d/%Y". ' + r"You might want to try:" ), ): pd.to_datetime(["01/01/2000", "31/05/2000", "31/05/2001", "01/02/2000"]) diff --git a/pandas/tests/series/test_constructors.py b/pandas/tests/series/test_constructors.py index 57b14d4b82a63..1771a4dfdb71f 100644 --- a/pandas/tests/series/test_constructors.py +++ b/pandas/tests/series/test_constructors.py @@ -83,7 +83,7 @@ def test_infer_with_date_and_datetime(self): def test_unparsable_strings_with_dt64_dtype(self): # pre-2.0 these would be silently ignored and come back with object dtype vals = ["aa"] - msg = "^Unknown datetime string format, unable to parse: aa, at position 0$" + msg = "^Unknown datetime string format, unable to parse: aa$" with pytest.raises(ValueError, match=msg): Series(vals, dtype="datetime64[ns]") diff --git a/pandas/tests/tslibs/test_array_to_datetime.py b/pandas/tests/tslibs/test_array_to_datetime.py index 3c55ae2c6f904..fc0000553049e 100644 --- a/pandas/tests/tslibs/test_array_to_datetime.py +++ b/pandas/tests/tslibs/test_array_to_datetime.py @@ -260,7 +260,7 @@ def test_to_datetime_barely_out_of_bounds(): # Close enough to bounds that dropping nanos # would result in an in-bounds datetime. arr = np.array(["2262-04-11 23:47:16.854775808"], dtype=object) - msg = "^Out of bounds nanosecond timestamp: 2262-04-11 23:47:16, at position 0$" + msg = "^Out of bounds nanosecond timestamp: 2262-04-11 23:47:16$" with pytest.raises(tslib.OutOfBoundsDatetime, match=msg): tslib.array_to_datetime(arr)