Skip to content

Commit 6dfc65d

Browse files
committed
update xarray test
1 parent 964c908 commit 6dfc65d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pandas/tests/generic/test_to_xarray.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313

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

16+
if xarray is not None and Version(xarray.__version__) < Version("2025.1.0"):
17+
pytestmark = pytest.mark.filterwarnings(
18+
"ignore:Converting non-nanosecond precision datetime:UserWarning"
19+
)
20+
1621

1722
class TestDataFrameToXArray:
1823
@pytest.fixture
@@ -77,6 +82,9 @@ def test_to_xarray_with_multiindex(self, df, using_infer_string):
7782
expected["f"] = expected["f"].astype(
7883
object if not using_infer_string else "str"
7984
)
85+
if Version(xarray.__version__) < Version("2025.1.0"):
86+
expected["g"] = expected["g"].astype("M8[ns]")
87+
expected["h"] = expected["h"].astype("M8[ns, US/Eastern]")
8088
expected.columns.name = None
8189
tm.assert_frame_equal(result, expected)
8290

0 commit comments

Comments
 (0)