1212import xarray as xr
1313import xarray .ufuncs as xu
1414from xarray import DataArray , Dataset , Variable
15+ from xarray .core import duck_array_ops
1516from xarray .testing import assert_chunks_equal
1617from xarray .tests import mock
1718
@@ -217,6 +218,8 @@ def test_reduce(self):
217218 self .assertLazyAndAllClose ((u < 1 ).all ("x" ), (v < 1 ).all ("x" ))
218219 with raises_regex (NotImplementedError , "dask" ):
219220 v .median ()
221+ with raise_if_dask_computes ():
222+ v .reduce (duck_array_ops .mean )
220223
221224 def test_missing_values (self ):
222225 values = np .array ([0 , 1 , np .nan , 3 ])
@@ -488,7 +491,17 @@ def test_groupby(self):
488491 v = self .lazy_array
489492
490493 expected = u .groupby ("x" ).mean (...)
491- actual = v .groupby ("x" ).mean (...)
494+ with raise_if_dask_computes ():
495+ actual = v .groupby ("x" ).mean (...)
496+ self .assertLazyAndAllClose (expected , actual )
497+
498+ def test_rolling (self ):
499+ u = self .eager_array
500+ v = self .lazy_array
501+
502+ expected = u .rolling (x = 2 ).mean ()
503+ with raise_if_dask_computes ():
504+ actual = v .rolling (x = 2 ).mean ()
492505 self .assertLazyAndAllClose (expected , actual )
493506
494507 def test_groupby_first (self ):
@@ -500,7 +513,8 @@ def test_groupby_first(self):
500513 with raises_regex (NotImplementedError , "dask" ):
501514 v .groupby ("ab" ).first ()
502515 expected = u .groupby ("ab" ).first ()
503- actual = v .groupby ("ab" ).first (skipna = False )
516+ with raise_if_dask_computes ():
517+ actual = v .groupby ("ab" ).first (skipna = False )
504518 self .assertLazyAndAllClose (expected , actual )
505519
506520 def test_reindex (self ):
0 commit comments