@@ -797,98 +797,99 @@ def test_array_equal_nan(a):
797797 assert_equal (result , expected )
798798
799799
800- @pytest .mark .parametrize (
801- "a" ,
802- [
803- numpy .array ([1 , 2 , 3 , 4 ]),
804- numpy .array ([[1 , 2 ], [3 , 4 ]]),
805- ],
806- )
807- @pytest .mark .parametrize (
808- "b" ,
809- [
810- numpy .array ([2 , 4 , 6 ]),
811- numpy .array ([[1 , 3 ], [5 , 7 ]]),
812- ],
813- )
814- def test_isin_basic (a , b ):
815- dp_a = dpnp .array (a )
816- dp_b = dpnp .array (b )
800+ class TestIsin :
801+ @pytest .mark .parametrize (
802+ "a" ,
803+ [
804+ numpy .array ([1 , 2 , 3 , 4 ]),
805+ numpy .array ([[1 , 2 ], [3 , 4 ]]),
806+ ],
807+ )
808+ @pytest .mark .parametrize (
809+ "b" ,
810+ [
811+ numpy .array ([2 , 4 , 6 ]),
812+ numpy .array ([[1 , 3 ], [5 , 7 ]]),
813+ ],
814+ )
815+ def test_isin_basic (a , b ):
816+ dp_a = dpnp .array (a )
817+ dp_b = dpnp .array (b )
817818
818- expected = numpy .isin (a , b )
819- result = dpnp .isin (dp_a , dp_b )
820- assert_equal (result , expected )
819+ expected = numpy .isin (a , b )
820+ result = dpnp .isin (dp_a , dp_b )
821+ assert_equal (result , expected )
821822
822823
823- @pytest .mark .parametrize ("dtype" , get_all_dtypes ())
824- def test_isin_dtype (dtype ):
825- a = numpy .array ([1 , 2 , 3 , 4 ], dtype = dtype )
826- b = numpy .array ([2 , 4 ], dtype = dtype )
824+ @pytest .mark .parametrize ("dtype" , get_all_dtypes (no_none = True ))
825+ def test_isin_dtype (dtype ):
826+ a = numpy .array ([1 , 2 , 3 , 4 ], dtype = dtype )
827+ b = numpy .array ([2 , 4 ], dtype = dtype )
827828
828- dp_a = dpnp .array (a , dtype = dtype )
829- dp_b = dpnp .array (b , dtype = dtype )
829+ dp_a = dpnp .array (a , dtype = dtype )
830+ dp_b = dpnp .array (b , dtype = dtype )
830831
831- expected = numpy .isin (a , b )
832- result = dpnp .isin (dp_a , dp_b )
833- assert_equal (result , expected )
832+ expected = numpy .isin (a , b )
833+ result = dpnp .isin (dp_a , dp_b )
834+ assert_equal (result , expected )
834835
835836
836- @pytest .mark .parametrize ("sh_a, sh_b" , [((3 , 1 ), (1 , 4 )), ((2 , 3 , 1 ), (1 , 1 ))])
837- def test_isin_broadcast (sh_a , sh_b ):
838- a = numpy .arange (numpy .prod (sh_a )).reshape (sh_a )
839- b = numpy .arange (numpy .prod (sh_b )).reshape (sh_b )
837+ @pytest .mark .parametrize ("sh_a, sh_b" , [((3 , 1 ), (1 , 4 )), ((2 , 3 , 1 ), (1 , 1 ))])
838+ def test_isin_broadcast (sh_a , sh_b ):
839+ a = numpy .arange (numpy .prod (sh_a )).reshape (sh_a )
840+ b = numpy .arange (numpy .prod (sh_b )).reshape (sh_b )
840841
841- dp_a = dpnp .array (a )
842- dp_b = dpnp .array (b )
842+ dp_a = dpnp .array (a )
843+ dp_b = dpnp .array (b )
843844
844- expected = numpy .isin (a , b )
845- result = dpnp .isin (dp_a , dp_b )
846- assert_equal (result , expected )
845+ expected = numpy .isin (a , b )
846+ result = dpnp .isin (dp_a , dp_b )
847+ assert_equal (result , expected )
847848
848849
849- def test_isin_scalar_elements ():
850- a = numpy .array ([1 , 2 , 3 ])
851- b = 2
850+ def test_isin_scalar_elements ():
851+ a = numpy .array ([1 , 2 , 3 ])
852+ b = 2
852853
853- dp_a = dpnp .array (a )
854- dp_b = dpnp .array (b )
854+ dp_a = dpnp .array (a )
855+ dp_b = dpnp .array (b )
855856
856- expected = numpy .isin (a , b )
857- result = dpnp .isin (dp_a , dp_b )
858- assert_equal (result , expected )
857+ expected = numpy .isin (a , b )
858+ result = dpnp .isin (dp_a , dp_b )
859+ assert_equal (result , expected )
859860
860861
861- def test_isin_scalar_test_elements ():
862- a = 2
863- b = numpy .array ([1 , 2 , 3 ])
862+ def test_isin_scalar_test_elements ():
863+ a = 2
864+ b = numpy .array ([1 , 2 , 3 ])
864865
865- dp_a = dpnp .array (a )
866- dp_b = dpnp .array (b )
866+ dp_a = dpnp .array (a )
867+ dp_b = dpnp .array (b )
867868
868- expected = numpy .isin (a , b )
869- result = dpnp .isin (dp_a , dp_b )
870- assert_equal (result , expected )
869+ expected = numpy .isin (a , b )
870+ result = dpnp .isin (dp_a , dp_b )
871+ assert_equal (result , expected )
871872
872873
873- def test_isin_empty ():
874- a = numpy .array ([], dtype = int )
875- b = numpy .array ([1 , 2 , 3 ])
874+ def test_isin_empty ():
875+ a = numpy .array ([], dtype = int )
876+ b = numpy .array ([1 , 2 , 3 ])
876877
877- dp_a = dpnp .array (a )
878- dp_b = dpnp .array (b )
878+ dp_a = dpnp .array (a )
879+ dp_b = dpnp .array (b )
879880
880- expected = numpy .isin (a , b )
881- result = dpnp .isin (dp_a , dp_b )
882- assert_equal (result , expected )
881+ expected = numpy .isin (a , b )
882+ result = dpnp .isin (dp_a , dp_b )
883+ assert_equal (result , expected )
883884
884885
885- def test_isin_errors ():
886- a = dpnp .arange (5 )
887- b = dpnp .arange (3 )
886+ def test_isin_errors ():
887+ a = dpnp .arange (5 )
888+ b = dpnp .arange (3 )
888889
889- # unsupported type for elements or test_elements
890- with pytest .raises (TypeError ):
891- dpnp .isin (dict (), b )
890+ # unsupported type for elements or test_elements
891+ with pytest .raises (TypeError ):
892+ dpnp .isin (dict (), b )
892893
893- with pytest .raises (TypeError ):
894- dpnp .isin (a , dict ())
894+ with pytest .raises (TypeError ):
895+ dpnp .isin (a , dict ())
0 commit comments