Skip to content

Commit

Permalink
TST: Improve compatibility with pypy error messages (pandas-dev#28844)
Browse files Browse the repository at this point in the history
  • Loading branch information
rlamy authored and proost committed Dec 19, 2019
1 parent 73f6d98 commit 03f837a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions pandas/tests/arithmetic/test_datetime64.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/arithmetic/test_timedelta64.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 03f837a

Please sign in to comment.