Skip to content

Commit 791e124

Browse files
committed
Add a simple test for showing missing ChunkedArray Manager
1 parent d9fb6b9 commit 791e124

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

xarray/tests/test_variable.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from xarray.core.types import T_DuckArray
3030
from xarray.core.utils import NDArrayMixin
3131
from xarray.core.variable import as_compatible_data, as_variable
32-
from xarray.namedarray.pycompat import array_type
32+
from xarray.namedarray.pycompat import array_type, is_chunked_array
3333
from xarray.tests import (
3434
assert_allclose,
3535
assert_array_equal,
@@ -2724,17 +2724,25 @@ def __init__(self, array):
27242724

27252725
def test_duck_array_with_chunks(self):
27262726
# Non indexable type
2727-
class CustomArray(NDArrayMixin, indexing.ExplicitlyIndexed):
2727+
class CustomArray(NDArrayMixin):
27282728
def __init__(self, array):
27292729
self.array = array
27302730

27312731
@property
27322732
def chunks(self):
27332733
return self.shape
27342734

2735+
def __array_function__(self, *args, **kwargs):
2736+
return NotImplemented
2737+
2738+
def __array_ufunc__(self, *args, **kwargs):
2739+
return NotImplemented
2740+
2741+
27352742
array = CustomArray(np.arange(3))
2736-
orig = Variable(dims=("x"), data=array, attrs={"foo": "bar"})
2737-
assert isinstance(orig._data, np.ndarray) # should not be CustomArray
2743+
assert is_chunked_array(array)
2744+
var = Variable(dims=("x"), data=array)
2745+
var.load()
27382746

27392747
def test_raise_no_warning_for_nan_in_binary_ops():
27402748
with assert_no_warnings():

0 commit comments

Comments
 (0)