Skip to content

Commit cd3639c

Browse files
committed
Update tests for pandas 3
1 parent 59e8260 commit cd3639c

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Issues = "https://github.com/daizutabi/xlviews/issues"
2727

2828
[dependency-groups]
2929
dev = [
30+
"pandas-stubs>=3.0.0.260204",
3031
"pytest>=9.0.1",
3132
"pytest-benchmark>=5.2.3",
3233
"pytest-clarity>=1.0.1",

tests/dataframes/agg/test_multi_index.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from importlib.metadata import version
2+
13
import numpy as np
24
import pytest
35
from pandas import DataFrame, Index, MultiIndex, Series
@@ -162,10 +164,17 @@ def test_df_group_str_str(df: DataFrame):
162164
@pytest.mark.filterwarnings("ignore::FutureWarning")
163165
def test_df_group_str_str_as_index_false(df: DataFrame):
164166
a = df.groupby("x", as_index=False).agg("sum")
165-
assert a.columns.to_list() == ["a", "b"]
166-
assert a.index.to_list() == [0, 1]
167-
assert a.index.name is None
168-
np.testing.assert_array_equal(a, [[10, 50], [26, 66]])
167+
if version("pandas").startswith("3."):
168+
assert a.columns.to_list() == ["x", "a", "b"]
169+
assert a.index.to_list() == [0, 1]
170+
assert a.index.name is None
171+
np.testing.assert_array_equal(a, [[1, 10, 50], [2, 26, 66]])
172+
173+
else:
174+
assert a.columns.to_list() == ["a", "b"]
175+
assert a.index.to_list() == [0, 1]
176+
assert a.index.name is None
177+
np.testing.assert_array_equal(a, [[10, 50], [26, 66]])
169178

170179

171180
def test_df_group_list_str(df: DataFrame):

0 commit comments

Comments
 (0)