4
4
import pytest
5
5
6
6
import dpnp as cupy
7
- from dpnp .tests .helper import has_support_aspect64
7
+ from dpnp .tests .helper import (
8
+ has_support_aspect64 ,
9
+ is_win_platform ,
10
+ numpy_version ,
11
+ )
8
12
from dpnp .tests .third_party .cupy import testing
9
13
10
14
@@ -101,10 +105,13 @@ def test_large_int_upper_1(self, xp, dtype):
101
105
@testing .for_int_dtypes (no_bool = True )
102
106
@testing .numpy_cupy_array_equal (accept_error = OverflowError )
103
107
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" :
107
- pytest .skip ("numpy promotes dtype differently" )
108
+ if numpy_version () < "2.0.0" :
109
+ flag = dtype in [xp .int16 , xp .int32 , xp .int64 , xp .longlong ]
110
+ if xp .issubdtype (dtype , xp .unsignedinteger ) or flag :
111
+ pytest .skip ("numpy doesn't raise OverflowError" )
112
+
113
+ if dtype == xp .int8 and is_win_platform ():
114
+ pytest .skip ("numpy promotes dtype differently" )
108
115
109
116
a = xp .array ([1 ], dtype = xp .int8 )
110
117
b = xp .iinfo (dtype ).max - 1
@@ -115,7 +122,7 @@ def test_large_int_upper_2(self, xp, dtype):
115
122
def test_large_int_upper_3 (self , xp , dtype ):
116
123
if (
117
124
numpy .issubdtype (dtype , numpy .unsignedinteger )
118
- and numpy . lib . NumpyVersion ( numpy . __version__ ) < "2.0.0"
125
+ and numpy_version ( ) < "2.0.0"
119
126
):
120
127
pytest .skip ("numpy promotes dtype differently" )
121
128
elif (
@@ -133,7 +140,7 @@ def test_large_int_upper_3(self, xp, dtype):
133
140
def test_large_int_upper_4 (self , xp , dtype ):
134
141
if (
135
142
numpy .issubdtype (dtype , numpy .unsignedinteger )
136
- and numpy . lib . NumpyVersion ( numpy . __version__ ) < "2.0.0"
143
+ and numpy_version ( ) < "2.0.0"
137
144
):
138
145
pytest .skip ("numpy promotes dtype differently" )
139
146
elif (
@@ -149,24 +156,27 @@ def test_large_int_upper_4(self, xp, dtype):
149
156
@testing .for_int_dtypes (no_bool = True )
150
157
@testing .numpy_cupy_array_equal (accept_error = OverflowError )
151
158
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" )
159
+ if numpy_version () < "2.0.0" :
160
+ if dtype in [xp .int16 , xp .int32 , xp .int64 , xp .longlong ]:
161
+ pytest .skip ("numpy doesn't raise OverflowError" )
162
+
163
+ if dtype == xp .int8 and is_win_platform ():
164
+ pytest .skip ("numpy promotes dtype differently" )
157
165
158
166
a = xp .array ([0 ], dtype = xp .int8 )
159
167
b = xp .iinfo (dtype ).min
168
+ res = a + b
160
169
return a + b
161
170
162
171
@testing .for_int_dtypes (no_bool = True )
163
172
@testing .numpy_cupy_array_equal (accept_error = OverflowError )
164
173
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" )
174
+ if numpy_version () < "2.0.0" :
175
+ if dtype in [xp .int16 , xp .int32 , xp .int64 , xp .longlong ]:
176
+ pytest .skip ("numpy doesn't raise OverflowError" )
177
+
178
+ if dtype == xp .int8 and is_win_platform ():
179
+ pytest .skip ("numpy promotes dtype differently" )
170
180
171
181
a = xp .array ([- 1 ], dtype = xp .int8 )
172
182
b = xp .iinfo (dtype ).min + 1
@@ -177,7 +187,7 @@ def test_large_int_lower_2(self, xp, dtype):
177
187
def test_large_int_lower_3 (self , xp , dtype ):
178
188
if (
179
189
numpy .issubdtype (dtype , numpy .unsignedinteger )
180
- and numpy . lib . NumpyVersion ( numpy . __version__ ) < "2.0.0"
190
+ and numpy_version ( ) < "2.0.0"
181
191
):
182
192
pytest .skip ("numpy promotes dtype differently" )
183
193
elif (
0 commit comments