Skip to content

Commit 7134301

Browse files
committed
no-change-third-party
1 parent 3547962 commit 7134301

File tree

2 files changed

+14
-38
lines changed

2 files changed

+14
-38
lines changed

dpnp/tests/third_party/cupy/core_tests/test_elementwise.py

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -94,19 +94,20 @@ class TestElementwiseType(unittest.TestCase):
9494
@testing.for_int_dtypes(no_bool=True)
9595
@testing.numpy_cupy_array_equal(accept_error=OverflowError)
9696
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)
9898
b = xp.iinfo(dtype).max
9999
return a + b
100100

101101
@testing.for_int_dtypes(no_bool=True)
102102
@testing.numpy_cupy_array_equal(accept_error=OverflowError)
103103
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+
):
107108
pytest.skip("numpy promotes dtype differently")
108109

109-
a = xp.array([1], dtype=xp.int8)
110+
a = xp.array([1], dtype=numpy.int8)
110111
b = xp.iinfo(dtype).max - 1
111112
return a + b
112113

@@ -149,26 +150,14 @@ def test_large_int_upper_4(self, xp, dtype):
149150
@testing.for_int_dtypes(no_bool=True)
150151
@testing.numpy_cupy_array_equal(accept_error=OverflowError)
151152
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)
159154
b = xp.iinfo(dtype).min
160155
return a + b
161156

162157
@testing.for_int_dtypes(no_bool=True)
163158
@testing.numpy_cupy_array_equal(accept_error=OverflowError)
164159
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)
172161
b = xp.iinfo(dtype).min + 1
173162
return a + b
174163

dpnp/tests/third_party/cupy/testing/_loops.py

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,30 +1082,17 @@ def _get_int_bool_dtypes():
10821082

10831083
_complex_dtypes = _get_supported_complex_dtypes()
10841084
_regular_float_dtypes = _get_supported_float_dtypes()
1085-
_float_dtypes = _get_float_dtypes()
1086-
_signed_dtypes = _get_signed_dtypes()
1087-
_unsigned_dtypes = _get_unsigned_dtypes()
1088-
_int_dtypes = _get_int_dtypes()
1089-
_int_bool_dtypes = _get_int_bool_dtypes()
1085+
_float_dtypes = _regular_float_dtypes
1086+
_signed_dtypes = ()
1087+
_unsigned_dtypes = tuple(numpy.dtype(i).type for i in "BHILQ")
1088+
_int_dtypes = _signed_dtypes + _unsigned_dtypes
1089+
_int_bool_dtypes = _int_dtypes
10901090
_regular_dtypes = _regular_float_dtypes + _int_bool_dtypes
10911091
_dtypes = _float_dtypes + _int_bool_dtypes
10921092

10931093

10941094
def _make_all_dtypes(no_float16, no_bool, no_complex):
1095-
if no_float16:
1096-
dtypes = _regular_float_dtypes
1097-
else:
1098-
dtypes = _float_dtypes
1099-
1100-
if no_bool:
1101-
dtypes += _int_dtypes
1102-
else:
1103-
dtypes += _int_bool_dtypes
1104-
1105-
if config.complex_types and not no_complex:
1106-
dtypes += _complex_dtypes
1107-
1108-
return dtypes
1095+
return (numpy.int64, numpy.int32) + _get_supported_float_dtypes()
11091096

11101097

11111098
def for_all_dtypes(

0 commit comments

Comments
 (0)