Skip to content

Commit

Permalink
Adjust tests in resample folder for new string option
Browse files Browse the repository at this point in the history
  • Loading branch information
phofl committed Nov 24, 2023
1 parent 38e29ab commit 3baa6ee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
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

0 comments on commit 3baa6ee

Please sign in to comment.