Skip to content

Commit c07563e

Browse files
authored
Adjust tests in resample folder for new string option (#56150)
1 parent f2c8715 commit c07563e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

pandas/tests/resample/test_base.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from pandas import (
77
DataFrame,
8+
Index,
89
MultiIndex,
910
NaT,
1011
PeriodIndex,
@@ -255,7 +256,7 @@ def test_resample_count_empty_dataframe(freq, empty_frame_dti):
255256

256257
index = _asfreq_compat(empty_frame_dti.index, freq)
257258

258-
expected = DataFrame({"a": []}, dtype="int64", index=index)
259+
expected = DataFrame(dtype="int64", index=index, columns=Index(["a"], dtype=object))
259260

260261
tm.assert_frame_equal(result, expected)
261262

pandas/tests/resample/test_resample_api.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def tests_raises_on_nuisance(test_frame):
197197
tm.assert_frame_equal(result, expected)
198198

199199
expected = r[["A", "B", "C"]].mean()
200-
msg = re.escape("agg function failed [how->mean,dtype->object]")
200+
msg = re.escape("agg function failed [how->mean,dtype->")
201201
with pytest.raises(TypeError, match=msg):
202202
r.mean()
203203
result = r.mean(numeric_only=True)
@@ -948,7 +948,7 @@ def test_frame_downsample_method(method, numeric_only, expected_data):
948948
if isinstance(expected_data, str):
949949
if method in ("var", "mean", "median", "prod"):
950950
klass = TypeError
951-
msg = re.escape(f"agg function failed [how->{method},dtype->object]")
951+
msg = re.escape(f"agg function failed [how->{method},dtype->")
952952
else:
953953
klass = ValueError
954954
msg = expected_data
@@ -998,7 +998,7 @@ def test_series_downsample_method(method, numeric_only, expected_data):
998998
with pytest.raises(TypeError, match=msg):
999999
func(**kwargs)
10001000
elif method == "prod":
1001-
msg = re.escape("agg function failed [how->prod,dtype->object]")
1001+
msg = re.escape("agg function failed [how->prod,dtype->")
10021002
with pytest.raises(TypeError, match=msg):
10031003
func(**kwargs)
10041004
else:

0 commit comments

Comments
 (0)