@@ -897,15 +897,24 @@ def test_push_dask():
897
897
898
898
@pytest .mark .parametrize ("shape" , [(200 , 1 ), (10 , 10 , 2 ), (4 , 50 )])
899
899
@pytest .mark .parametrize ("tolerance" , [1e-2 , 1e-4 , 1e-6 ])
900
- def test_isin_tolerance (shape , tolerance ):
901
- in_margin = tolerance / 2 # in margin
900
+ @pytest .mark .parametrize ("dask" , [False , True ])
901
+ def test_isin_tolerance (shape , tolerance , dask ):
902
+ if dask and not has_dask :
903
+ pytest .skip ("requires dask" )
904
+
905
+ in_margin = tolerance / 2 # within acceptable margin
902
906
arrayA = np .arange (- 10.0 , 10.0 , 0.1 ).reshape (shape )
907
+
903
908
expected = np .array ([item % 2 == 0 for item in range (0 , arrayA .size )]).reshape (
904
909
shape
905
910
)
906
- for c in range ( 1 , 5 ) :
911
+ for offset_direction in [ 1 , - 1 ] :
907
912
# generate test set
908
- arrayB = - 99 * (~ expected .flatten ()) + (in_margin + arrayA * expected ).flatten ()
909
- with raise_if_dask_computes ():
910
- actual = isin_tolerance (arrayA , arrayB , tolerance )
911
- np .testing .assert_equal (actual , expected )
913
+ arrayB = - 99 * (~ expected ) + (in_margin + arrayA * expected )
914
+ if dask :
915
+ import dask .array
916
+
917
+ arrayB = dask .array .from_array (arrayB )
918
+
919
+ actual = isin_tolerance (arrayA , arrayB , tolerance )
920
+ np .testing .assert_equal (actual , expected )
0 commit comments