3232 get_integer_dtypes ,
3333 has_support_aspect16 ,
3434 has_support_aspect64 ,
35+ numpy_version ,
3536)
3637from .test_umath import (
3738 _get_numpy_arrays_1in_1out ,
@@ -1408,7 +1409,7 @@ class TestLdexp:
14081409 @pytest .mark .parametrize ("exp_dt" , get_integer_dtypes ())
14091410 def test_basic (self , mant_dt , exp_dt ):
14101411 if (
1411- numpy . lib . NumpyVersion ( numpy . __version__ ) < "2.0.0"
1412+ numpy_version ( ) < "2.0.0"
14121413 and exp_dt == numpy .int64
14131414 and numpy .dtype ("l" ) != numpy .int64
14141415 ):
@@ -1421,9 +1422,7 @@ def test_basic(self, mant_dt, exp_dt):
14211422 if dpnp .issubdtype (exp_dt , dpnp .uint64 ):
14221423 assert_raises (ValueError , dpnp .ldexp , imant , iexp )
14231424 assert_raises (TypeError , numpy .ldexp , mant , exp )
1424- elif numpy .lib .NumpyVersion (
1425- numpy .__version__
1426- ) < "2.0.0" and dpnp .issubdtype (exp_dt , dpnp .uint32 ):
1425+ elif numpy_version () < "2.0.0" and dpnp .issubdtype (exp_dt , dpnp .uint32 ):
14271426 # For this special case, NumPy < "2.0.0" raises an error on Windows
14281427 result = dpnp .ldexp (imant , iexp )
14291428 expected = numpy .ldexp (mant , exp .astype (numpy .int32 ))
@@ -2130,7 +2129,7 @@ def test_zeros(self, dt):
21302129
21312130 result = dpnp .spacing (ia )
21322131 expected = numpy .spacing (a )
2133- if numpy . lib . NumpyVersion ( numpy . __version__ ) < "2.0.0" :
2132+ if numpy_version ( ) < "2.0.0" :
21342133 assert_equal (result , expected )
21352134 else :
21362135 # numpy.spacing(-0.0) == numpy.spacing(0.0), i.e. NumPy returns
@@ -2193,7 +2192,7 @@ def test_complex(self, xp):
21932192
21942193class TestTrapezoid :
21952194 def get_numpy_func (self ):
2196- if numpy . lib . NumpyVersion ( numpy . __version__ ) < "2.0.0" :
2195+ if numpy_version ( ) < "2.0.0" :
21972196 # `trapz` is deprecated in NumPy 2.0
21982197 return numpy .trapz
21992198 return numpy .trapezoid
@@ -2753,10 +2752,7 @@ def test_out(self, func_params, dtype):
27532752 # NumPy < 2.0.0 while output has the dtype of input for NumPy >= 2.0.0
27542753 # (dpnp follows the latter behavior except for boolean dtype where it
27552754 # returns int8)
2756- if (
2757- numpy .lib .NumpyVersion (numpy .__version__ ) < "2.0.0"
2758- or dtype == numpy .bool
2759- ):
2755+ if numpy_version () < "2.0.0" or dtype == numpy .bool :
27602756 check_type = False
27612757 else :
27622758 check_type = True
0 commit comments