Skip to content

Commit 81fe55a

Browse files
authored
Fix sparse dask repr test (pydata#10200)
1 parent 6f354e2 commit 81fe55a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

xarray/tests/test_sparse.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import numpy as np
88
import pandas as pd
99
import pytest
10+
from packaging.version import Version
1011

1112
import xarray as xr
1213
import xarray.ufuncs as xu
@@ -719,13 +720,17 @@ def test_sparse_dask_dataset_repr(self):
719720
ds = xr.Dataset(
720721
data_vars={"a": ("x", sparse.COO.from_numpy(np.ones(4)))}
721722
).chunk()
723+
if Version(sparse.__version__) >= Version("0.16.0"):
724+
meta = "sparse.numba_backend._coo.core.COO"
725+
else:
726+
meta = "sparse.COO"
722727
expected = dedent(
723-
"""\
728+
f"""\
724729
<xarray.Dataset> Size: 32B
725730
Dimensions: (x: 4)
726731
Dimensions without coordinates: x
727732
Data variables:
728-
a (x) float64 32B dask.array<chunksize=(4,), meta=sparse.COO>"""
733+
a (x) float64 32B dask.array<chunksize=(4,), meta={meta}>"""
729734
)
730735
assert expected == repr(ds)
731736

0 commit comments

Comments
 (0)