Skip to content

Commit 17ace06

Browse files
committed
fix tests due to changed error message
1 parent 5b20b59 commit 17ace06

File tree

2 files changed

+6
-19
lines changed

2 files changed

+6
-19
lines changed

pandas/tests/arithmetic/test_datetime64.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,9 +1274,7 @@ def test_dt64arr_series_sub_tick_DateOffset(self, box_with_array):
12741274

12751275
result2 = -pd.offsets.Second(5) + ser
12761276
tm.assert_equal(result2, expected)
1277-
msg = (
1278-
"TypeError: unsupported operand type(s) for -: 'DatetimeArray' and 'Second'"
1279-
)
1277+
msg = "Unsupported operand type(s) for -: 'DatetimeArray' and 'Second'"
12801278
with pytest.raises(TypeError, match=re.escape(msg)):
12811279
pd.offsets.Second(5) - ser
12821280

@@ -1322,7 +1320,7 @@ def test_dti_add_tick_tzaware(self, tz_aware_fixture, box_with_array):
13221320
tm.assert_equal(roundtrip, dates)
13231321

13241322
msg = (
1325-
r"TypeError: unsupported operand type\(s\) "
1323+
r"Unsupported operand type\(s\) "
13261324
"for -: 'DatetimeArray' and '.*'|"
13271325
r"cannot subtract DatetimeArray from .*"
13281326
)
@@ -1384,10 +1382,7 @@ def test_dt64arr_add_sub_relativedelta_offsets(self, box_with_array, unit):
13841382
expected = DatetimeIndex([x - off for x in vec_items]).as_unit(exp_unit)
13851383
expected = tm.box_expected(expected, box_with_array)
13861384
tm.assert_equal(expected, vec - off)
1387-
msg = (
1388-
r"TypeError: unsupported operand type\(s\) "
1389-
"for -: 'DatetimeArray' and '.*'"
1390-
)
1385+
msg = r"Unsupported operand type\(s\) " "for -: 'DatetimeArray' and '.*'"
13911386
with pytest.raises(TypeError, match=msg):
13921387
off - vec
13931388

@@ -1503,9 +1498,7 @@ def test_dt64arr_add_sub_DateOffsets(
15031498
expected = DatetimeIndex([offset + x for x in vec_items]).as_unit(unit)
15041499
expected = tm.box_expected(expected, box_with_array)
15051500
tm.assert_equal(expected, offset + vec)
1506-
msg = (
1507-
r"TypeError: unsupported operand type\(s\) for -: 'DatetimeArray' and '.*'"
1508-
)
1501+
msg = r"Unsupported operand type\(s\) for -: 'DatetimeArray' and '.*'"
15091502
with pytest.raises(TypeError, match=msg):
15101503
offset - vec
15111504

@@ -1994,10 +1987,7 @@ def test_operators_datetimelike_with_timezones(self):
19941987
result = dt1 - td1[0]
19951988
exp = (dt1.dt.tz_localize(None) - td1[0]).dt.tz_localize(tz)
19961989
tm.assert_series_equal(result, exp)
1997-
msg = (
1998-
r"TypeError: unsupported operand type\(s\) "
1999-
"for -: 'DatetimeArray' and 'Timedelta'"
2000-
)
1990+
msg = r"Unsupported operand type\(s\) " "for -: 'DatetimeArray' and 'Timedelta'"
20011991
with pytest.raises(TypeError, match=msg):
20021992
td1[0] - dt1
20031993

pandas/tests/arithmetic/test_timedelta64.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,7 @@ def test_subtraction_ops(self):
320320
with pytest.raises(TypeError, match=msg):
321321
td - dt
322322

323-
msg = (
324-
r"TypeError: unsupported operand type\(s\) "
325-
"for -: 'DatetimeArray' and 'Timedelta'"
326-
)
323+
msg = r"Unsupported operand type\(s\) " "for -: 'DatetimeArray' and 'Timedelta'"
327324
with pytest.raises(TypeError, match=msg):
328325
td - dti
329326

0 commit comments

Comments
 (0)