Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
hmaarrfk committed Feb 13, 2024
1 parent d644607 commit d9fb6b9
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions xarray/tests/test_variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -2722,6 +2722,19 @@ def __init__(self, array):
orig = Variable(dims=(), data=array)
assert isinstance(orig._data.item(), CustomWithValuesAttr)

def test_duck_array_with_chunks(self):
# Non indexable type
class CustomArray(NDArrayMixin, indexing.ExplicitlyIndexed):
def __init__(self, array):
self.array = array

@property
def chunks(self):
return self.shape

array = CustomArray(np.arange(3))
orig = Variable(dims=("x"), data=array, attrs={"foo": "bar"})
assert isinstance(orig._data, np.ndarray) # should not be CustomArray

def test_raise_no_warning_for_nan_in_binary_ops():
with assert_no_warnings():
Expand Down

0 comments on commit d9fb6b9

Please sign in to comment.