@@ -94,19 +94,20 @@ class TestElementwiseType(unittest.TestCase):
94
94
@testing .for_int_dtypes (no_bool = True )
95
95
@testing .numpy_cupy_array_equal (accept_error = OverflowError )
96
96
def test_large_int_upper_1 (self , xp , dtype ):
97
- a = xp .array ([0 ], dtype = xp .int8 )
97
+ a = xp .array ([0 ], dtype = numpy .int8 )
98
98
b = xp .iinfo (dtype ).max
99
99
return a + b
100
100
101
101
@testing .for_int_dtypes (no_bool = True )
102
102
@testing .numpy_cupy_array_equal (accept_error = OverflowError )
103
103
def test_large_int_upper_2 (self , xp , dtype ):
104
- flag = dtype in [numpy .int16 , numpy .int32 , numpy .int64 , numpy .longlong ]
105
- flag = numpy .issubdtype (dtype , numpy .unsignedinteger ) or flag
106
- if flag and numpy .lib .NumpyVersion (numpy .__version__ ) < "2.0.0" :
104
+ if (
105
+ numpy .issubdtype (dtype , numpy .unsignedinteger )
106
+ and numpy .lib .NumpyVersion (numpy .__version__ ) < "2.0.0"
107
+ ):
107
108
pytest .skip ("numpy promotes dtype differently" )
108
109
109
- a = xp .array ([1 ], dtype = xp .int8 )
110
+ a = xp .array ([1 ], dtype = numpy .int8 )
110
111
b = xp .iinfo (dtype ).max - 1
111
112
return a + b
112
113
@@ -149,26 +150,14 @@ def test_large_int_upper_4(self, xp, dtype):
149
150
@testing .for_int_dtypes (no_bool = True )
150
151
@testing .numpy_cupy_array_equal (accept_error = OverflowError )
151
152
def test_large_int_lower_1 (self , xp , dtype ):
152
- if (
153
- dtype in [numpy .int16 , numpy .int32 , numpy .int64 , numpy .longlong ]
154
- and numpy .lib .NumpyVersion (numpy .__version__ ) < "2.0.0"
155
- ):
156
- pytest .skip ("numpy promotes dtype differently" )
157
-
158
- a = xp .array ([0 ], dtype = xp .int8 )
153
+ a = xp .array ([0 ], dtype = numpy .int8 )
159
154
b = xp .iinfo (dtype ).min
160
155
return a + b
161
156
162
157
@testing .for_int_dtypes (no_bool = True )
163
158
@testing .numpy_cupy_array_equal (accept_error = OverflowError )
164
159
def test_large_int_lower_2 (self , xp , dtype ):
165
- if (
166
- dtype in [numpy .int16 , numpy .int32 , numpy .int64 , numpy .longlong ]
167
- and numpy .lib .NumpyVersion (numpy .__version__ ) < "2.0.0"
168
- ):
169
- pytest .skip ("numpy promotes dtype differently" )
170
-
171
- a = xp .array ([- 1 ], dtype = xp .int8 )
160
+ a = xp .array ([- 1 ], dtype = numpy .int8 )
172
161
b = xp .iinfo (dtype ).min + 1
173
162
return a + b
174
163
0 commit comments