Skip to content
/ xarray Public
forked from pydata/xarray

Commit

Permalink
propagate the dtypes
Browse files Browse the repository at this point in the history
  • Loading branch information
keewis committed Aug 15, 2021
1 parent 71a37ba commit 1d98fec
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions xarray/tests/duckarrays/test_sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ def disable_bottleneck():
yield


def create(op, shape):
def create(op, shape, dtypes):
def convert(arr):
if arr.ndim == 0:
return arr

return sparse.COO.from_numpy(arr)

return strategies.numpy_array(shape).map(convert)
return strategies.numpy_array(shape, dtypes).map(convert)


def as_dense(obj):
Expand Down Expand Up @@ -74,8 +74,8 @@ def as_dense(obj):
)
class TestSparseVariableReduceMethods(base.VariableReduceTests):
@staticmethod
def create(op, shape):
return create(op, shape)
def create(op, shape, dtypes):
return create(op, shape, dtypes)

def check_reduce(self, obj, op, *args, **kwargs):
actual = as_dense(getattr(obj, op)(*args, **kwargs))
Expand All @@ -97,8 +97,8 @@ def check_reduce(self, obj, op, *args, **kwargs):
)
class TestSparseDataArrayReduceMethods(base.DataArrayReduceTests):
@staticmethod
def create(op, shape):
return create(op, shape)
def create(op, shape, dtypes):
return create(op, shape, dtypes)

def check_reduce(self, obj, op, *args, **kwargs):
actual = as_dense(getattr(obj, op)(*args, **kwargs))
Expand All @@ -120,8 +120,8 @@ def check_reduce(self, obj, op, *args, **kwargs):
)
class TestSparseDatasetReduceMethods(base.DatasetReduceTests):
@staticmethod
def create(op, shape):
return create(op, shape)
def create(op, shape, dtypes):
return create(op, shape, dtypes)

def check_reduce(self, obj, op, *args, **kwargs):
actual = as_dense(getattr(obj, op)(*args, **kwargs))
Expand Down

0 comments on commit 1d98fec

Please sign in to comment.