@@ -421,46 +421,37 @@ def test_ffill():
421
421
assert_equal (actual , expected )
422
422
423
423
424
- def test_ffill_use_bottleneck_numbagg ():
424
+ @pytest .mark .parametrize ("compute_backend" , [None ], indirect = True )
425
+ @pytest .mark .parametrize ("method" , ["ffill" , "bfill" ])
426
+ def test_b_ffill_use_bottleneck_numbagg (method , compute_backend ):
427
+ """
428
+ bfill & ffill fail if both bottleneck and numba are disabled
429
+ """
425
430
da = xr .DataArray (np .array ([4 , 5 , np .nan ], dtype = np .float64 ), dims = "x" )
426
- with xr .set_options (use_bottleneck = False , use_numbagg = False ):
427
- with pytest .raises (RuntimeError ):
428
- da .ffill ("x" )
431
+ with pytest .raises (RuntimeError ):
432
+ getattr (da , method )("x" )
429
433
430
434
431
435
@requires_dask
432
- def test_ffill_use_bottleneck_dask ():
436
+ @pytest .mark .parametrize ("compute_backend" , [None ], indirect = True )
437
+ @pytest .mark .parametrize ("method" , ["ffill" , "bfill" ])
438
+ def test_b_ffill_use_bottleneck_dask (method , compute_backend ):
439
+ """
440
+ ffill fails if both bottleneck and numba are disabled, on dask arrays
441
+ """
433
442
da = xr .DataArray (np .array ([4 , 5 , np .nan ], dtype = np .float64 ), dims = "x" )
434
- da = da .chunk ({"x" : 1 })
435
- with xr .set_options (use_bottleneck = False , use_numbagg = False ):
436
- with pytest .raises (RuntimeError ):
437
- da .ffill ("x" )
443
+ with pytest .raises (RuntimeError ):
444
+ getattr (da , method )("x" )
438
445
439
446
440
447
@requires_numbagg
441
448
@requires_dask
442
- def test_ffill_use_numbagg_dask ():
443
- with xr .set_options (use_bottleneck = False ):
444
- da = xr .DataArray (np .array ([4 , 5 , np .nan ], dtype = np .float64 ), dims = "x" )
445
- da = da .chunk (x = - 1 )
446
- # Succeeds with a single chunk:
447
- _ = da .ffill ("x" ).compute ()
448
-
449
-
450
- def test_bfill_use_bottleneck ():
451
- da = xr .DataArray (np .array ([4 , 5 , np .nan ], dtype = np .float64 ), dims = "x" )
452
- with xr .set_options (use_bottleneck = False , use_numbagg = False ):
453
- with pytest .raises (RuntimeError ):
454
- da .bfill ("x" )
455
-
456
-
457
- @requires_dask
458
- def test_bfill_use_bottleneck_dask ():
449
+ @pytest .mark .parametrize ("compute_backend" , ["numbagg" ], indirect = True )
450
+ def test_ffill_use_numbagg_dask (compute_backend ):
459
451
da = xr .DataArray (np .array ([4 , 5 , np .nan ], dtype = np .float64 ), dims = "x" )
460
- da = da .chunk ({"x" : 1 })
461
- with xr .set_options (use_bottleneck = False , use_numbagg = False ):
462
- with pytest .raises (RuntimeError ):
463
- da .bfill ("x" )
452
+ da = da .chunk (x = - 1 )
453
+ # Succeeds with a single chunk:
454
+ _ = da .ffill ("x" ).compute ()
464
455
465
456
466
457
@requires_bottleneck
0 commit comments