Skip to content

Adjust tests in resample folder for new string option #56150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pandas/tests/resample/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from pandas import (
DataFrame,
Index,
MultiIndex,
NaT,
PeriodIndex,
Expand Down Expand Up @@ -255,7 +256,7 @@ def test_resample_count_empty_dataframe(freq, empty_frame_dti):

index = _asfreq_compat(empty_frame_dti.index, freq)

expected = DataFrame({"a": []}, dtype="int64", index=index)
expected = DataFrame(dtype="int64", index=index, columns=Index(["a"], dtype=object))

tm.assert_frame_equal(result, expected)

Expand Down
6 changes: 3 additions & 3 deletions pandas/tests/resample/test_resample_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def tests_raises_on_nuisance(test_frame):
tm.assert_frame_equal(result, expected)

expected = r[["A", "B", "C"]].mean()
msg = re.escape("agg function failed [how->mean,dtype->object]")
msg = re.escape("agg function failed [how->mean,dtype->")
with pytest.raises(TypeError, match=msg):
r.mean()
result = r.mean(numeric_only=True)
Expand Down Expand Up @@ -948,7 +948,7 @@ def test_frame_downsample_method(method, numeric_only, expected_data):
if isinstance(expected_data, str):
if method in ("var", "mean", "median", "prod"):
klass = TypeError
msg = re.escape(f"agg function failed [how->{method},dtype->object]")
msg = re.escape(f"agg function failed [how->{method},dtype->")
else:
klass = ValueError
msg = expected_data
Expand Down Expand Up @@ -998,7 +998,7 @@ def test_series_downsample_method(method, numeric_only, expected_data):
with pytest.raises(TypeError, match=msg):
func(**kwargs)
elif method == "prod":
msg = re.escape("agg function failed [how->prod,dtype->object]")
msg = re.escape("agg function failed [how->prod,dtype->")
with pytest.raises(TypeError, match=msg):
func(**kwargs)
else:
Expand Down