@@ -291,7 +291,6 @@ def test_dtype_deprecation(self, xp):
291291 convolve (a , b )
292292
293293
294- @pytest .mark .filterwarnings ("ignore::FutureWarning:dask" )
295294@skip_xp_backends (cpu_only = True , exceptions = ['cupy' ])
296295class TestConvolve2d :
297296
@@ -477,8 +476,12 @@ def test_consistency_convolve_funcs(self, xp):
477476 a = xp .arange (5 )
478477 b = xp .asarray ([3.2 , 1.4 , 3 ])
479478 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 ))
479+ # cast to numpy when calling np.convolve
480+ # to prevent NEP18 dispatching e.g. from dask
481+ xp_assert_close (
482+ xp .asarray (np .convolve (np .asarray (a ), np .asarray (b ), mode = mode )),
483+ signal .convolve (a , b , mode = mode )
484+ )
482485 xp_assert_close (
483486 xp .squeeze (
484487 signal .convolve2d (xp .asarray ([a ]), xp .asarray ([b ]), mode = mode ),
@@ -508,7 +511,6 @@ def test_large_array(self, xp):
508511 assert fails [0 ].size == 0
509512
510513
511- @pytest .mark .filterwarnings ("ignore::FutureWarning:dask" )
512514@skip_xp_backends (cpu_only = True , exceptions = ['cupy' ])
513515class TestFFTConvolve :
514516
@@ -845,7 +847,9 @@ def test_random_data(self, axes, xp):
845847 np .random .seed (1234 )
846848 a = xp .asarray (np .random .rand (1233 ) + 1j * np .random .rand (1233 ))
847849 b = xp .asarray (np .random .rand (1321 ) + 1j * np .random .rand (1321 ))
848- expected = xp .asarray (np .convolve (a , b , 'full' ))
850+ # cast to numpy before np.convolve
851+ # to prevent NEP 18 dispatching for e.g. dask
852+ expected = xp .asarray (np .convolve (np .asarray (a ), np .asarray (b ), 'full' ))
849853
850854 if axes == '' :
851855 out = fftconvolve (a , b , 'full' )
@@ -860,7 +864,9 @@ def test_random_data_axes(self, axes, xp):
860864 np .random .seed (1234 )
861865 a = xp .asarray (np .random .rand (1233 ) + 1j * np .random .rand (1233 ))
862866 b = xp .asarray (np .random .rand (1321 ) + 1j * np .random .rand (1321 ))
863- expected = xp .asarray (np .convolve (a , b , 'full' ))
867+ # cast to numpy before np.convolve
868+ # to prevent NEP 18 dispatching for e.g. dask
869+ expected = xp .asarray (np .convolve (np .asarray (a ), np .asarray (b ), 'full' ))
864870
865871 a = xp .asarray (np .tile (a , [2 , 1 ]))
866872 b = xp .asarray (np .tile (b , [2 , 1 ]))
@@ -913,7 +919,9 @@ def test_random_data_multidim_axes(self, axes, xp):
913919 def test_many_sizes (self , n , xp ):
914920 a = xp .asarray (np .random .rand (n ) + 1j * np .random .rand (n ))
915921 b = xp .asarray (np .random .rand (n ) + 1j * np .random .rand (n ))
916- expected = xp .asarray (np .convolve (a , b , 'full' ))
922+ # cast to numpy before np.convolve
923+ # to prevent NEP 18 dispatching for e.g. dask
924+ expected = xp .asarray (np .convolve (np .asarray (a ), np .asarray (b ), 'full' ))
917925
918926 out = fftconvolve (a , b , 'full' )
919927 xp_assert_close (out , expected , atol = 1e-10 )
@@ -965,10 +973,7 @@ def gen_oa_shapes_eq(sizes):
965973
966974
967975@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- )
976+ @skip_xp_backends ("dask.array" , reason = "wrong answer" )
972977class TestOAConvolve :
973978 @pytest .mark .slow ()
974979 @pytest .mark .parametrize ('shape_a_0, shape_b_0' ,
@@ -2452,7 +2457,6 @@ def decimal(self, dt, xp):
24522457 dt = np .cdouble
24532458
24542459 # emulate np.finfo(dt).precision for complex64 and complex128
2455- # note: unwrapped dask has no finfo
24562460 prec = {64 : 15 , 32 : 6 }[xp .finfo (dt ).bits ]
24572461 return int (2 * prec / 3 )
24582462
@@ -4018,7 +4022,6 @@ def test_nonnumeric_dtypes(func, xp):
40184022class TestSOSFilt :
40194023
40204024 # The test_rank* tests are pulled from _TestLinearFilter
4021- @pytest .mark .filterwarnings ("ignore::FutureWarning" ) # for dask
40224025 @skip_xp_backends ('jax.numpy' , reason = 'buffer array is read-only' )
40234026 def test_rank1 (self , dt , xp ):
40244027 dt = getattr (xp , dt )
@@ -4050,7 +4053,6 @@ def test_rank1(self, dt, xp):
40504053 y = sosfilt (sos , x )
40514054 xp_assert_close (y , xp .asarray ([1.0 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ]))
40524055
4053- @pytest .mark .filterwarnings ("ignore::FutureWarning" ) # for dask
40544056 @skip_xp_backends ('jax.numpy' , reason = 'buffer array is read-only' )
40554057 def test_rank2 (self , dt , xp ):
40564058 dt = getattr (xp , dt )
@@ -4078,7 +4080,6 @@ def test_rank2(self, dt, xp):
40784080 y = sosfilt (sos , x , axis = 1 )
40794081 assert_array_almost_equal (y_r2_a1 , y )
40804082
4081- @pytest .mark .filterwarnings ("ignore::FutureWarning" ) # for dask
40824083 @skip_xp_backends ('jax.numpy' , reason = 'buffer array is read-only' )
40834084 def test_rank3 (self , dt , xp ):
40844085 dt = getattr (xp , dt )
@@ -4334,7 +4335,6 @@ def test_bp(self, xp):
43344335 with assert_raises (ValueError ):
43354336 detrend (data , type = "linear" , bp = 3 )
43364337
4337- @pytest .mark .filterwarnings ("ignore::FutureWarning:dask" )
43384338 @pytest .mark .parametrize ('bp' , [np .array ([0 , 2 ]), [0 , 2 ]])
43394339 def test_detrend_array_bp (self , bp , xp ):
43404340 # regression test for https://github.com/scipy/scipy/issues/18675
0 commit comments