Skip to content

Commit 149c943

Browse files
jbrockmendelKevin D Smith
authored and
Kevin D Smith
committed
fix test test warnings (pandas-dev#36640)
1 parent 3d21d11 commit 149c943

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

pandas/tests/io/excel/test_writers.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1286,10 +1286,9 @@ def test_merged_cell_custom_objects(self, merge_cells, path):
12861286
expected.to_excel(path)
12871287
result = pd.read_excel(path, header=[0, 1], index_col=0, convert_float=False)
12881288
# need to convert PeriodIndexes to standard Indexes for assert equal
1289-
expected.columns.set_levels(
1289+
expected.columns = expected.columns.set_levels(
12901290
[[str(i) for i in mi.levels[0]], [str(i) for i in mi.levels[1]]],
12911291
level=[0, 1],
1292-
inplace=True,
12931292
)
12941293
expected.index = expected.index.astype(np.float64)
12951294
tm.assert_frame_equal(expected, result)

pandas/tests/series/apply/test_series_transform.py

+13-8
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,20 @@ def test_transform_bad_dtype(op):
121121
s = Series(3 * [object]) # Series that will fail on most transforms
122122
if op in ("backfill", "shift", "pad", "bfill", "ffill"):
123123
pytest.xfail("Transform function works on any datatype")
124+
124125
msg = "Transform function failed"
125-
with pytest.raises(ValueError, match=msg):
126-
s.transform(op)
127-
with pytest.raises(ValueError, match=msg):
128-
s.transform([op])
129-
with pytest.raises(ValueError, match=msg):
130-
s.transform({"A": op})
131-
with pytest.raises(ValueError, match=msg):
132-
s.transform({"A": [op]})
126+
127+
# tshift is deprecated
128+
warn = None if op != "tshift" else FutureWarning
129+
with tm.assert_produces_warning(warn, check_stacklevel=False):
130+
with pytest.raises(ValueError, match=msg):
131+
s.transform(op)
132+
with pytest.raises(ValueError, match=msg):
133+
s.transform([op])
134+
with pytest.raises(ValueError, match=msg):
135+
s.transform({"A": op})
136+
with pytest.raises(ValueError, match=msg):
137+
s.transform({"A": [op]})
133138

134139

135140
@pytest.mark.parametrize("use_apply", [True, False])

0 commit comments

Comments
 (0)