From a320dff55fb9cebd0849415da87aa9ae69f08079 Mon Sep 17 00:00:00 2001 From: Stephan Hoyer Date: Mon, 4 May 2020 15:40:18 -0700 Subject: [PATCH 1/3] Remove broken test for Panel with to_pandas() We don't support creating a Panel with to_pandas() with *any* version of pandas at present, so this test was previous broken if pandas < 0.25 was isntalled. --- xarray/tests/test_dataset.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/xarray/tests/test_dataset.py b/xarray/tests/test_dataset.py index a1cb7361e77..0ae610589a3 100644 --- a/xarray/tests/test_dataset.py +++ b/xarray/tests/test_dataset.py @@ -496,16 +496,11 @@ def test_constructor_pandas_single(self): DataArray(np.random.rand(4, 3), dims=["a", "b"]), # df ] - if LooseVersion(pd.__version__) < "0.25.0": - das.append(DataArray(np.random.rand(4, 3, 2), dims=["a", "b", "c"])) - - with warnings.catch_warnings(): - warnings.filterwarnings("ignore", r"\W*Panel is deprecated") - for a in das: - pandas_obj = a.to_pandas() - ds_based_on_pandas = Dataset(pandas_obj) - for dim in ds_based_on_pandas.data_vars: - assert_array_equal(ds_based_on_pandas[dim], pandas_obj[dim]) + for a in das: + pandas_obj = a.to_pandas() + ds_based_on_pandas = Dataset(pandas_obj) + for dim in ds_based_on_pandas.data_vars: + assert_array_equal(ds_based_on_pandas[dim], pandas_obj[dim]) def test_constructor_compat(self): data = {"x": DataArray(0, coords={"y": 1}), "y": ("z", [1, 1, 1])} From 969228e85ed86154c550b1dd45722ceaa9654f94 Mon Sep 17 00:00:00 2001 From: Stephan Hoyer Date: Mon, 4 May 2020 15:42:19 -0700 Subject: [PATCH 2/3] remove unused import --- xarray/tests/test_dataarray.py | 1 - 1 file changed, 1 deletion(-) diff --git a/xarray/tests/test_dataarray.py b/xarray/tests/test_dataarray.py index c3e5aafabfe..3f886b377e6 100644 --- a/xarray/tests/test_dataarray.py +++ b/xarray/tests/test_dataarray.py @@ -17,7 +17,6 @@ from xarray.core.indexes import propagate_indexes from xarray.core.utils import is_scalar from xarray.tests import ( - LooseVersion, ReturnItem, assert_allclose, assert_array_equal, From 2571860a48c71ec049ecea93968897a9b523f06d Mon Sep 17 00:00:00 2001 From: Stephan Hoyer Date: Mon, 4 May 2020 18:08:27 -0700 Subject: [PATCH 3/3] Fixup LooseVersion import --- xarray/tests/test_dataarray.py | 1 + xarray/tests/test_dataset.py | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/xarray/tests/test_dataarray.py b/xarray/tests/test_dataarray.py index 3f886b377e6..c3e5aafabfe 100644 --- a/xarray/tests/test_dataarray.py +++ b/xarray/tests/test_dataarray.py @@ -17,6 +17,7 @@ from xarray.core.indexes import propagate_indexes from xarray.core.utils import is_scalar from xarray.tests import ( + LooseVersion, ReturnItem, assert_allclose, assert_array_equal, diff --git a/xarray/tests/test_dataset.py b/xarray/tests/test_dataset.py index 0ae610589a3..2a89920766c 100644 --- a/xarray/tests/test_dataset.py +++ b/xarray/tests/test_dataset.py @@ -32,7 +32,6 @@ from . import ( InaccessibleArray, - LooseVersion, UnexpectedDataAccess, assert_allclose, assert_array_equal,