Skip to content

Commit 7672a92

Browse files
committed
update TestResultType
1 parent a0e178c commit 7672a92

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/third_party/cupy/test_type_routines.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import pytest
55

66
import dpnp as cupy
7+
from tests.helper import has_support_aspect64
78
from tests.third_party.cupy import testing
89

910

@@ -97,6 +98,23 @@ def test_result_type(self, xp, dtype1, dtype2):
9798
input1 = _generate_type_routines_input(xp, dtype1, self.obj_type1)
9899

99100
input2 = _generate_type_routines_input(xp, dtype2, self.obj_type2)
101+
102+
flag1 = isinstance(input1, (numpy.ndarray, cupy.ndarray))
103+
flag2 = isinstance(input2, (numpy.ndarray, cupy.ndarray))
104+
dt1 = cupy.dtype(input1) if not flag1 else None
105+
dt2 = cupy.dtype(input2) if not flag2 else None
106+
# dpnp takes into account devices capabilities only if one of the
107+
# inputs is an array, for such a case, if the other dtype is not
108+
# supported by device, dpnp raise ValueError. So, we skip the test.
109+
if flag1 or flag2:
110+
if (
111+
dt1 in [cupy.float64, cupy.complex128]
112+
or dt2 in [cupy.float64, cupy.complex128]
113+
and not has_support_aspect64()
114+
):
115+
pytest.skip("No fp64 support by device.")
116+
100117
ret = xp.result_type(input1, input2)
118+
101119
assert isinstance(ret, numpy.dtype)
102120
return ret

0 commit comments

Comments
 (0)