@@ -67,7 +67,8 @@ def test_angle(self, dtype, deg):
6767 result = dpnp .angle (dp_a , deg = deg )
6868
6969 # For dtype=int8, uint8, NumPy returns float16, but dpnp returns float32
70- assert_dtype_allclose (result , expected , check_only_type_kind = True )
70+ dt_int8 = dtype in [dpnp .int8 , dpnp .uint8 ]
71+ assert_dtype_allclose (result , expected , check_only_type_kind = dt_int8 )
7172
7273 @pytest .mark .parametrize ("dtype" , get_complex_dtypes ())
7374 def test_angle_complex (self , dtype , deg ):
@@ -1352,8 +1353,7 @@ def test_1d(self, dt):
13521353 expected = numpy .i0 (a )
13531354 # NumPy promotes result of integer inputs to float64, but dpnp
13541355 # follows Type Promotion Rules
1355- skip_dtype = [numpy .int8 , numpy .int16 , numpy .uint8 , numpy .uint16 ]
1356- flag = True if dt in skip_dtype else False
1356+ flag = dt in [numpy .int8 , numpy .int16 , numpy .uint8 , numpy .uint16 ]
13571357 assert_dtype_allclose (result , expected , check_only_type_kind = flag )
13581358
13591359 @pytest .mark .parametrize ("dt" , get_float_dtypes ())
@@ -2034,7 +2034,8 @@ def test_basic(self, dt):
20342034 expected = numpy .sinc (a )
20352035 # numpy promotes result for integer inputs to float64 dtype, but dpnp
20362036 # follows Type Promotion Rules similar to other trigonometric functions
2037- assert_dtype_allclose (result , expected , check_only_type_kind = True )
2037+ flag = dt in [numpy .int8 , numpy .int16 , numpy .uint8 , numpy .uint16 ]
2038+ assert_dtype_allclose (result , expected , check_only_type_kind = flag )
20382039
20392040 def test_bool (self ):
20402041 a = numpy .array ([True , False , True ])
@@ -2054,7 +2055,8 @@ def test_zero(self, dt):
20542055 expected = numpy .sinc (a )
20552056 # numpy promotes result for integer inputs to float64 dtype, but dpnp
20562057 # follows Type Promotion Rules similar to other trigonometric functions
2057- assert_dtype_allclose (result , expected , check_only_type_kind = True )
2058+ flag = dt in [numpy .int8 , numpy .int16 , numpy .uint8 , numpy .uint16 ]
2059+ assert_dtype_allclose (result , expected , check_only_type_kind = flag )
20582060
20592061 # TODO: add a proper NumPy version once resolved
20602062 @testing .with_requires ("numpy>=2.0.0" )
@@ -2499,7 +2501,7 @@ def test_divide_scalar(shape, dtype):
24992501)
25002502def test_negative (data , dtype ):
25012503 np_a = numpy .array (data , dtype = dtype )
2502- dpnp_a = dpnp .array (data , dtype = dtype )
2504+ dpnp_a = dpnp .array (np_a )
25032505
25042506 result = dpnp .negative (dpnp_a )
25052507 expected = numpy .negative (np_a )
@@ -2529,12 +2531,10 @@ def test_negative_boolean():
25292531 [[[1.0 , - 1.0 ], [0.1 , - 0.1 ]], [- 2 , - 1 , 0 , 1 , 2 ]],
25302532 ids = ["[[1., -1.], [0.1, -0.1]]" , "[-2, -1, 0, 1, 2]" ],
25312533)
2532- @pytest .mark .parametrize (
2533- "dtype" , get_all_dtypes (no_bool = True , no_unsigned = True )
2534- )
2534+ @pytest .mark .parametrize ("dtype" , get_all_dtypes (no_bool = True ))
25352535def test_positive (data , dtype ):
2536- np_a = numpy . array (data , dtype = dtype )
2537- dpnp_a = dpnp .array (data , dtype = dtype )
2536+ np_a = get_abs_array (data , dtype = dtype )
2537+ dpnp_a = dpnp .array (np_a )
25382538
25392539 result = dpnp .positive (dpnp_a )
25402540 expected = numpy .positive (np_a )
0 commit comments