@@ -1685,6 +1685,7 @@ def test_axis_list(self, axis):
16851685 expected = numpy .unique (a , axis = axis )
16861686 assert_array_equal (result , expected )
16871687
1688+ @testing .with_requires ("numpy>=2.0.1" )
16881689 @pytest .mark .parametrize ("dt" , get_all_dtypes (no_none = True ))
16891690 @pytest .mark .parametrize (
16901691 "axis_kwd" ,
@@ -1716,17 +1717,6 @@ def test_2d_axis(self, dt, axis_kwd, return_kwds):
17161717 if len (return_kwds ) == 0 :
17171718 assert_array_equal (result , expected )
17181719 else :
1719- if (
1720- len (axis_kwd ) == 0
1721- and numpy .lib .NumpyVersion (numpy .__version__ ) < "2.0.1"
1722- ):
1723- # gh-26961: numpy.unique(..., return_inverse=True, axis=None)
1724- # returned flatten unique_inverse till 2.0.1 version
1725- expected = (
1726- expected [:2 ]
1727- + (expected [2 ].reshape (a .shape ),)
1728- + expected [3 :]
1729- )
17301720 for iv , v in zip (result , expected ):
17311721 assert_array_equal (iv , v )
17321722
@@ -1756,17 +1746,14 @@ def test_1d_axis(self, axis):
17561746 expected = numpy .unique (a , axis = axis )
17571747 assert_array_equal (result , expected )
17581748
1749+ @testing .with_requires ("numpy>=2.0.1" )
17591750 @pytest .mark .parametrize ("axis" , [None , 0 , - 1 ])
17601751 def test_2d_axis_inverse (self , axis ):
17611752 a = numpy .array ([[4 , 4 , 3 ], [2 , 2 , 1 ], [2 , 2 , 1 ], [4 , 4 , 3 ]])
17621753 ia = dpnp .array (a )
17631754
17641755 result = dpnp .unique (ia , return_inverse = True , axis = axis )
17651756 expected = numpy .unique (a , return_inverse = True , axis = axis )
1766- if axis is None and numpy .lib .NumpyVersion (numpy .__version__ ) < "2.0.1" :
1767- # gh-26961: numpy.unique(..., return_inverse=True, axis=None)
1768- # returned flatten unique_inverse till 2.0.1 version
1769- expected = expected [:1 ] + (expected [1 ].reshape (a .shape ),)
17701757
17711758 for iv , v in zip (result , expected ):
17721759 assert_array_equal (iv , v )
@@ -1847,6 +1834,7 @@ def test_1d_equal_nan_axis0(self):
18471834 expected = numpy .unique (a , axis = 0 , equal_nan = True )
18481835 assert_array_equal (result , expected )
18491836
1837+ @testing .with_requires ("numpy>=2.0.1" )
18501838 @pytest .mark .parametrize ("dt" , get_float_complex_dtypes ())
18511839 @pytest .mark .parametrize (
18521840 "axis_kwd" ,
@@ -1888,14 +1876,6 @@ def test_2d_axis_nans(self, dt, axis_kwd, return_kwds, row):
18881876 if len (return_kwds ) == 0 :
18891877 assert_array_equal (result , expected )
18901878 else :
1891- if len (axis_kwd ) == 0 and numpy_version () < "2.0.1" :
1892- # gh-26961: numpy.unique(..., return_inverse=True, axis=None)
1893- # returned flatten unique_inverse till 2.0.1 version
1894- expected = (
1895- expected [:2 ]
1896- + (expected [2 ].reshape (a .shape ),)
1897- + expected [3 :]
1898- )
18991879 for iv , v in zip (result , expected ):
19001880 assert_array_equal (iv , v )
19011881
0 commit comments