diff --git a/pandas/tests/arithmetic/test_datetime64.py b/pandas/tests/arithmetic/test_datetime64.py index 6f7222f523579..d239687a37757 100644 --- a/pandas/tests/arithmetic/test_datetime64.py +++ b/pandas/tests/arithmetic/test_datetime64.py @@ -887,7 +887,7 @@ def test_dt64arr_add_sub_td64ndarray(self, tz_naive_fixture, box_with_array): result = dtarr - tdarr tm.assert_equal(result, expected) - msg = "cannot subtract|bad operand type for unary -" + msg = "cannot subtract|(bad|unsupported) operand type for unary" with pytest.raises(TypeError, match=msg): tdarr - dtarr @@ -1126,7 +1126,7 @@ def test_dt64arr_series_sub_tick_DateOffset(self, box_with_array): result2 = -pd.offsets.Second(5) + ser tm.assert_equal(result2, expected) - msg = "bad operand type for unary" + msg = "(bad|unsupported) operand type for unary" with pytest.raises(TypeError, match=msg): pd.offsets.Second(5) - ser @@ -1220,7 +1220,7 @@ def test_dt64arr_add_sub_relativedelta_offsets(self, box_with_array): expected = DatetimeIndex([x - off for x in vec_items]) expected = tm.box_expected(expected, box_with_array) tm.assert_equal(expected, vec - off) - msg = "bad operand type for unary" + msg = "(bad|unsupported) operand type for unary" with pytest.raises(TypeError, match=msg): off - vec @@ -1336,7 +1336,7 @@ def test_dt64arr_add_sub_DateOffsets( expected = DatetimeIndex([offset + x for x in vec_items]) expected = tm.box_expected(expected, box_with_array) tm.assert_equal(expected, offset + vec) - msg = "bad operand type for unary" + msg = "(bad|unsupported) operand type for unary" with pytest.raises(TypeError, match=msg): offset - vec @@ -1920,7 +1920,7 @@ def test_operators_datetimelike_with_timezones(self): result = dt1 - td1[0] exp = (dt1.dt.tz_localize(None) - td1[0]).dt.tz_localize(tz) tm.assert_series_equal(result, exp) - msg = "bad operand type for unary" + msg = "(bad|unsupported) operand type for unary" with pytest.raises(TypeError, match=msg): td1[0] - dt1 diff --git a/pandas/tests/arithmetic/test_timedelta64.py b/pandas/tests/arithmetic/test_timedelta64.py index d480b26e30fff..ecb07fa49036a 100644 --- a/pandas/tests/arithmetic/test_timedelta64.py +++ b/pandas/tests/arithmetic/test_timedelta64.py @@ -245,7 +245,7 @@ def test_subtraction_ops(self): with pytest.raises(TypeError, match=msg): td - dt - msg = "bad operand type for unary -: 'DatetimeArray'" + msg = "(bad|unsupported) operand type for unary" with pytest.raises(TypeError, match=msg): td - dti