Skip to content

Commit

Permalink
mypy, xfail one more sparse
Browse files Browse the repository at this point in the history
  • Loading branch information
slevang committed Nov 23, 2024
1 parent 5aa4a39 commit 390df6f
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions xarray/tests/test_duck_array_wrapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,27 @@
# Don't run cupy in CI because it requires a GPU
NAMESPACE_ARRAYS = {
"jax.numpy": {
"array": "ndarray",
"constructor": "asarray",
"attrs": {
"array": "ndarray",
"constructor": "asarray",
},
"xfails": {
"rolling": "no sliding_window_view",
"rolling_mean": "no sliding_window_view",
},
},
"cupy": {
"array": "ndarray",
"constructor": "asarray",
"attrs": {
"array": "ndarray",
"constructor": "asarray",
},
"xfails": {"quantile": "no nanquantile"},
},
"pint": {
"array": "Quantity",
"constructor": "Quantity",
"attrs": {
"array": "Quantity",
"constructor": "Quantity",
},
"xfails": {
"all": "returns a bool",
"any": "returns a bool",
Expand All @@ -42,13 +48,16 @@
},
},
"sparse": {
"array": "COO",
"constructor": "COO",
"attrs": {
"array": "COO",
"constructor": "COO",
},
"xfails": {
"cov": "dense output",
"corr": "no nanstd",
"cross": "no cross",
"count": "dense output",
"dot": "fails on some platforms/versions",
"isin": "no isin",
"rolling": "no sliding_window_view",
"rolling_mean": "no sliding_window_view",
Expand Down Expand Up @@ -79,8 +88,10 @@ class _BaseTest:
def setup_for_test(self, request, namespace):
self.namespace = namespace
self.xp = pytest.importorskip(namespace)
self.Array = getattr(self.xp, NAMESPACE_ARRAYS[namespace]["array"])
self.constructor = getattr(self.xp, NAMESPACE_ARRAYS[namespace]["constructor"])
self.Array = getattr(self.xp, NAMESPACE_ARRAYS[namespace]["attrs"]["array"])
self.constructor = getattr(
self.xp, NAMESPACE_ARRAYS[namespace]["attrs"]["constructor"]
)
xarray_method = request.node.name.split("test_")[1].split("[")[0]
if xarray_method in NAMESPACE_ARRAYS[namespace]["xfails"]:
reason = NAMESPACE_ARRAYS[namespace]["xfails"][xarray_method]
Expand Down

0 comments on commit 390df6f

Please sign in to comment.