Skip to content

Commit 25b1859

Browse files
rlamyWillAyd
authored andcommitted
TST: Improve compatibility with pypy error messages (#28844)
1 parent c9b6261 commit 25b1859

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

pandas/tests/arithmetic/test_datetime64.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ def test_dt64arr_add_sub_td64ndarray(self, tz_naive_fixture, box_with_array):
887887

888888
result = dtarr - tdarr
889889
tm.assert_equal(result, expected)
890-
msg = "cannot subtract|bad operand type for unary -"
890+
msg = "cannot subtract|(bad|unsupported) operand type for unary"
891891
with pytest.raises(TypeError, match=msg):
892892
tdarr - dtarr
893893

@@ -1126,7 +1126,7 @@ def test_dt64arr_series_sub_tick_DateOffset(self, box_with_array):
11261126

11271127
result2 = -pd.offsets.Second(5) + ser
11281128
tm.assert_equal(result2, expected)
1129-
msg = "bad operand type for unary"
1129+
msg = "(bad|unsupported) operand type for unary"
11301130
with pytest.raises(TypeError, match=msg):
11311131
pd.offsets.Second(5) - ser
11321132

@@ -1220,7 +1220,7 @@ def test_dt64arr_add_sub_relativedelta_offsets(self, box_with_array):
12201220
expected = DatetimeIndex([x - off for x in vec_items])
12211221
expected = tm.box_expected(expected, box_with_array)
12221222
tm.assert_equal(expected, vec - off)
1223-
msg = "bad operand type for unary"
1223+
msg = "(bad|unsupported) operand type for unary"
12241224
with pytest.raises(TypeError, match=msg):
12251225
off - vec
12261226

@@ -1336,7 +1336,7 @@ def test_dt64arr_add_sub_DateOffsets(
13361336
expected = DatetimeIndex([offset + x for x in vec_items])
13371337
expected = tm.box_expected(expected, box_with_array)
13381338
tm.assert_equal(expected, offset + vec)
1339-
msg = "bad operand type for unary"
1339+
msg = "(bad|unsupported) operand type for unary"
13401340
with pytest.raises(TypeError, match=msg):
13411341
offset - vec
13421342

@@ -1920,7 +1920,7 @@ def test_operators_datetimelike_with_timezones(self):
19201920
result = dt1 - td1[0]
19211921
exp = (dt1.dt.tz_localize(None) - td1[0]).dt.tz_localize(tz)
19221922
tm.assert_series_equal(result, exp)
1923-
msg = "bad operand type for unary"
1923+
msg = "(bad|unsupported) operand type for unary"
19241924
with pytest.raises(TypeError, match=msg):
19251925
td1[0] - dt1
19261926

pandas/tests/arithmetic/test_timedelta64.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def test_subtraction_ops(self):
245245
with pytest.raises(TypeError, match=msg):
246246
td - dt
247247

248-
msg = "bad operand type for unary -: 'DatetimeArray'"
248+
msg = "(bad|unsupported) operand type for unary"
249249
with pytest.raises(TypeError, match=msg):
250250
td - dti
251251

0 commit comments

Comments
 (0)