Skip to content

Commit

Permalink
Remove broken test for Panel with to_pandas() (#4028)
Browse files Browse the repository at this point in the history
* 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.

* remove unused import

* Fixup LooseVersion import
  • Loading branch information
shoyer authored May 6, 2020
1 parent 59b470f commit 9ec3f7b
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions xarray/tests/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

from . import (
InaccessibleArray,
LooseVersion,
UnexpectedDataAccess,
assert_allclose,
assert_array_equal,
Expand Down Expand Up @@ -496,16 +495,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])}
Expand Down

0 comments on commit 9ec3f7b

Please sign in to comment.