@@ -291,7 +291,7 @@ def test_dtype_deprecation(self, xp):
291291 convolve (a , b )
292292
293293
294- @ pytest . mark . filterwarnings ( "ignore::FutureWarning:dask" )
294+
295295@skip_xp_backends (cpu_only = True , exceptions = ['cupy' ])
296296class TestConvolve2d :
297297
@@ -477,8 +477,12 @@ def test_consistency_convolve_funcs(self, xp):
477477 a = xp .arange (5 )
478478 b = xp .asarray ([3.2 , 1.4 , 3 ])
479479 for mode in ['full' , 'valid' , 'same' ]:
480- xp_assert_close (xp .asarray (np .convolve (a , b , mode = mode )),
481- signal .convolve (a , b , mode = mode ))
480+ # cast to numpy when calling np.convolve
481+ # to prevent NEP18 dispatching e.g. from dask
482+ xp_assert_close (
483+ xp .asarray (np .convolve (np .asarray (a ), np .asarray (b ), mode = mode )),
484+ signal .convolve (a , b , mode = mode )
485+ )
482486 xp_assert_close (
483487 xp .squeeze (
484488 signal .convolve2d (xp .asarray ([a ]), xp .asarray ([b ]), mode = mode ),
@@ -508,7 +512,7 @@ def test_large_array(self, xp):
508512 assert fails [0 ].size == 0
509513
510514
511- @ pytest . mark . filterwarnings ( "ignore::FutureWarning:dask" )
515+
512516@skip_xp_backends (cpu_only = True , exceptions = ['cupy' ])
513517class TestFFTConvolve :
514518
@@ -845,7 +849,9 @@ def test_random_data(self, axes, xp):
845849 np .random .seed (1234 )
846850 a = xp .asarray (np .random .rand (1233 ) + 1j * np .random .rand (1233 ))
847851 b = xp .asarray (np .random .rand (1321 ) + 1j * np .random .rand (1321 ))
848- expected = xp .asarray (np .convolve (a , b , 'full' ))
852+ # cast to numpy before np.convolve
853+ # to prevent NEP 18 dispatching for e.g. dask
854+ expected = xp .asarray (np .convolve (np .asarray (a ), np .asarray (b ), 'full' ))
849855
850856 if axes == '' :
851857 out = fftconvolve (a , b , 'full' )
@@ -860,7 +866,9 @@ def test_random_data_axes(self, axes, xp):
860866 np .random .seed (1234 )
861867 a = xp .asarray (np .random .rand (1233 ) + 1j * np .random .rand (1233 ))
862868 b = xp .asarray (np .random .rand (1321 ) + 1j * np .random .rand (1321 ))
863- expected = xp .asarray (np .convolve (a , b , 'full' ))
869+ # cast to numpy before np.convolve
870+ # to prevent NEP 18 dispatching for e.g. dask
871+ expected = xp .asarray (np .convolve (np .asarray (a ), np .asarray (b ), 'full' ))
864872
865873 a = xp .asarray (np .tile (a , [2 , 1 ]))
866874 b = xp .asarray (np .tile (b , [2 , 1 ]))
@@ -913,7 +921,9 @@ def test_random_data_multidim_axes(self, axes, xp):
913921 def test_many_sizes (self , n , xp ):
914922 a = xp .asarray (np .random .rand (n ) + 1j * np .random .rand (n ))
915923 b = xp .asarray (np .random .rand (n ) + 1j * np .random .rand (n ))
916- expected = xp .asarray (np .convolve (a , b , 'full' ))
924+ # cast to numpy before np.convolve
925+ # to prevent NEP 18 dispatching for e.g. dask
926+ expected = xp .asarray (np .convolve (np .asarray (a ), np .asarray (b ), 'full' ))
917927
918928 out = fftconvolve (a , b , 'full' )
919929 xp_assert_close (out , expected , atol = 1e-10 )
@@ -965,10 +975,7 @@ def gen_oa_shapes_eq(sizes):
965975
966976
967977@skip_xp_backends ("jax.numpy" , reason = "fails all around" )
968- @skip_xp_backends ("dask.array" ,
969- reason = "Gets converted to numpy at some point for some reason. "
970- "Probably also suffers from boolean indexing issues"
971- )
978+ @skip_xp_backends ("dask.array" , reason = "wrong answer" )
972979class TestOAConvolve :
973980 @pytest .mark .slow ()
974981 @pytest .mark .parametrize ('shape_a_0, shape_b_0' ,
@@ -2452,7 +2459,6 @@ def decimal(self, dt, xp):
24522459 dt = np .cdouble
24532460
24542461 # emulate np.finfo(dt).precision for complex64 and complex128
2455- # note: unwrapped dask has no finfo
24562462 prec = {64 : 15 , 32 : 6 }[xp .finfo (dt ).bits ]
24572463 return int (2 * prec / 3 )
24582464
@@ -4018,7 +4024,6 @@ def test_nonnumeric_dtypes(func, xp):
40184024class TestSOSFilt :
40194025
40204026 # The test_rank* tests are pulled from _TestLinearFilter
4021- @pytest .mark .filterwarnings ("ignore::FutureWarning" ) # for dask
40224027 @skip_xp_backends ('jax.numpy' , reason = 'buffer array is read-only' )
40234028 def test_rank1 (self , dt , xp ):
40244029 dt = getattr (xp , dt )
@@ -4050,7 +4055,6 @@ def test_rank1(self, dt, xp):
40504055 y = sosfilt (sos , x )
40514056 xp_assert_close (y , xp .asarray ([1.0 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ]))
40524057
4053- @pytest .mark .filterwarnings ("ignore::FutureWarning" ) # for dask
40544058 @skip_xp_backends ('jax.numpy' , reason = 'buffer array is read-only' )
40554059 def test_rank2 (self , dt , xp ):
40564060 dt = getattr (xp , dt )
@@ -4078,7 +4082,6 @@ def test_rank2(self, dt, xp):
40784082 y = sosfilt (sos , x , axis = 1 )
40794083 assert_array_almost_equal (y_r2_a1 , y )
40804084
4081- @pytest .mark .filterwarnings ("ignore::FutureWarning" ) # for dask
40824085 @skip_xp_backends ('jax.numpy' , reason = 'buffer array is read-only' )
40834086 def test_rank3 (self , dt , xp ):
40844087 dt = getattr (xp , dt )
@@ -4334,7 +4337,6 @@ def test_bp(self, xp):
43344337 with assert_raises (ValueError ):
43354338 detrend (data , type = "linear" , bp = 3 )
43364339
4337- @pytest .mark .filterwarnings ("ignore::FutureWarning:dask" )
43384340 @pytest .mark .parametrize ('bp' , [np .array ([0 , 2 ]), [0 , 2 ]])
43394341 def test_detrend_array_bp (self , bp , xp ):
43404342 # regression test for https://github.com/scipy/scipy/issues/18675
0 commit comments