Skip to content

[backport 2.3.x] TST: update xfail xarray version check in to_xarray test (#61648) #61652

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
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
18 changes: 16 additions & 2 deletions pandas/tests/generic/test_to_xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
DataFrame,
MultiIndex,
Series,
StringDtype,
date_range,
)
import pandas._testing as tm
from pandas.util.version import Version

pytest.importorskip("xarray")
xarray = pytest.importorskip("xarray")


class TestDataFrameToXArray:
Expand Down Expand Up @@ -88,8 +90,20 @@ def test_to_xarray_with_multiindex(self, df, using_infer_string):


class TestSeriesToXArray:
def test_to_xarray_index_types(self, index_flat):
def test_to_xarray_index_types(self, index_flat, request):
index = index_flat
if (
isinstance(index.dtype, StringDtype)
and index.dtype.storage == "pyarrow"
and Version(xarray.__version__) > Version("2024.9.0")
and Version(xarray.__version__) < Version("2025.6.0")
):
request.applymarker(
pytest.mark.xfail(
reason="xarray calling reshape of ArrowExtensionArray",
raises=NotImplementedError,
)
)
# MultiIndex is tested in test_to_xarray_with_multiindex

from xarray import DataArray
Expand Down
Loading