Skip to content

Commit 2c2ba45

Browse files
authored
CLN: xarray tests (#32943)
1 parent f20331d commit 2c2ba45

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

pandas/tests/generic/test_to_xarray.py

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from distutils.version import LooseVersion
2-
31
import numpy as np
42
import pytest
53

@@ -9,21 +7,9 @@
97
from pandas import DataFrame, Series
108
import pandas._testing as tm
119

12-
try:
13-
import xarray
14-
15-
_XARRAY_INSTALLED = True
16-
except ImportError:
17-
_XARRAY_INSTALLED = False
18-
1910

2011
class TestDataFrameToXArray:
21-
@pytest.mark.skipif(
22-
not _XARRAY_INSTALLED
23-
or _XARRAY_INSTALLED
24-
and LooseVersion(xarray.__version__) < LooseVersion("0.10.0"),
25-
reason="xarray >= 0.10.0 required",
26-
)
12+
@td.skip_if_no("xarray", "0.10.0")
2713
def test_to_xarray_index_types(self, indices):
2814
if isinstance(indices, pd.MultiIndex):
2915
pytest.skip("MultiIndex is tested separately")
@@ -106,12 +92,7 @@ def test_to_xarray(self):
10692

10793

10894
class TestSeriesToXArray:
109-
@pytest.mark.skipif(
110-
not _XARRAY_INSTALLED
111-
or _XARRAY_INSTALLED
112-
and LooseVersion(xarray.__version__) < LooseVersion("0.10.0"),
113-
reason="xarray >= 0.10.0 required",
114-
)
95+
@td.skip_if_no("xarray", "0.10.0")
11596
def test_to_xarray_index_types(self, indices):
11697
if isinstance(indices, pd.MultiIndex):
11798
pytest.skip("MultiIndex is tested separately")

0 commit comments

Comments
 (0)