@@ -4947,7 +4947,7 @@ def test_idxmin(
4947
4947
with pytest .raises (ValueError ):
4948
4948
xr .DataArray (5 ).idxmin ()
4949
4949
4950
- coordarr0 = xr .DataArray (ar0 .coords ["x" ], dims = ["x" ])
4950
+ coordarr0 = xr .DataArray (ar0 .coords ["x" ]. data , dims = ["x" ])
4951
4951
coordarr1 = coordarr0 .copy ()
4952
4952
4953
4953
hasna = np .isnan (minindex )
@@ -5062,7 +5062,7 @@ def test_idxmax(
5062
5062
with pytest .raises (ValueError ):
5063
5063
xr .DataArray (5 ).idxmax ()
5064
5064
5065
- coordarr0 = xr .DataArray (ar0 .coords ["x" ], dims = ["x" ])
5065
+ coordarr0 = xr .DataArray (ar0 .coords ["x" ]. data , dims = ["x" ])
5066
5066
coordarr1 = coordarr0 .copy ()
5067
5067
5068
5068
hasna = np .isnan (maxindex )
@@ -7167,3 +7167,13 @@ def test_nD_coord_dataarray() -> None:
7167
7167
_assert_internal_invariants (da4 , check_default_indexes = True )
7168
7168
assert "x" not in da4 .xindexes
7169
7169
assert "x" in da4 .coords
7170
+
7171
+
7172
+ def test_lazy_data_variable_not_loaded ():
7173
+ # GH8753
7174
+ array = InaccessibleArray (np .array ([1 , 2 , 3 ]))
7175
+ v = Variable (data = array , dims = "x" )
7176
+ # No data needs to be accessed, so no error should be raised
7177
+ da = xr .DataArray (v )
7178
+ # No data needs to be accessed, so no error should be raised
7179
+ xr .DataArray (da )
0 commit comments