@@ -847,6 +847,36 @@ def test_where_scalars():
847847 xp .where (condition , 0 , 1 )
848848
849849
850+ # Set functions
851+
852+ @pytest .mark .parametrize (("low" , "high" ), [(0 , 10 )])
853+ @pytest .mark .parametrize (
854+ ("elements_shape" , "elements_chunks" ),
855+ [((10 ,), (5 ,)), ((10 ,), (3 ,)), ((4 , 5 ), (3 , 2 )), ((20 , 20 ), (4 , 5 ))],
856+ )
857+ @pytest .mark .parametrize (
858+ ("test_shape" , "test_chunks" ),
859+ [((10 ,), (5 ,)), ((10 ,), (3 ,)), ((4 , 5 ), (3 , 2 )), ((20 , 20 ), (4 , 5 ))],
860+ )
861+ @pytest .mark .parametrize ("invert" , [True , False ])
862+ def test_isin (
863+ low , high , elements_shape , elements_chunks , test_shape , test_chunks , invert
864+ ):
865+ # based on dask test
866+ rng = np .random .default_rng ()
867+
868+ a1 = rng .integers (low , high , size = elements_shape )
869+ c1 = cubed .from_array (a1 , chunks = elements_chunks )
870+
871+ a2 = rng .integers (low , high , size = test_shape ) - 5
872+ c2 = cubed .from_array (a2 , chunks = test_chunks )
873+
874+ r_a = np .isin (a1 , a2 , invert = invert )
875+ r_c = xp .isin (c1 , c2 , invert = invert )
876+
877+ assert_array_equal (r_c , r_a )
878+
879+
850880# Statistical functions
851881
852882
0 commit comments