File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -2722,6 +2722,19 @@ def __init__(self, array):
2722
2722
orig = Variable (dims = (), data = array )
2723
2723
assert isinstance (orig ._data .item (), CustomWithValuesAttr )
2724
2724
2725
+ def test_duck_array_with_chunks (self ):
2726
+ # Non indexable type
2727
+ class CustomArray (NDArrayMixin , indexing .ExplicitlyIndexed ):
2728
+ def __init__ (self , array ):
2729
+ self .array = array
2730
+
2731
+ @property
2732
+ def chunks (self ):
2733
+ return self .shape
2734
+
2735
+ 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
2725
2738
2726
2739
def test_raise_no_warning_for_nan_in_binary_ops ():
2727
2740
with assert_no_warnings ():
You can’t perform that action at this time.
0 commit comments