Skip to content

Commit 7ec0856

Browse files
committed
Update manipulation_tests/test_kind.py
1 parent b4d0d74 commit 7ec0856

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

dpnp/tests/third_party/cupy/manipulation_tests/test_kind.py

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
import pytest
55

66
import dpnp as cupy
7-
from dpnp.tests.helper import has_support_aspect64
87
from dpnp.tests.third_party.cupy import testing
98

109

1110
class TestKind(unittest.TestCase):
11+
1212
@testing.for_orders("CFAK")
1313
@testing.for_all_dtypes()
1414
@testing.numpy_cupy_array_equal()
@@ -28,29 +28,16 @@ def test_asarray_chkfinite_non_finite_vals(self, dtype, order):
2828
with pytest.raises(error):
2929
xp.asarray_chkfinite(a, dtype=dtype, order=order)
3030

31-
@testing.with_requires("numpy<2.0")
32-
@testing.for_all_dtypes()
33-
def test_asfarray(self, dtype):
34-
a = cupy.asarray([1, 2, 3])
35-
a_gpu = cupy.asfarray(a, dtype)
36-
a_cpu = numpy.asfarray(a, dtype)
37-
if (
38-
has_support_aspect64()
39-
or cupy.issubdtype(dtype, cupy.complexfloating)
40-
or cupy.issubdtype(dtype, cupy.floating)
41-
):
42-
assert a_cpu.dtype == a_gpu.dtype
43-
else:
44-
assert a_cpu.dtype == cupy.float64
45-
assert a_gpu.dtype == cupy.float32
46-
4731
@testing.for_all_dtypes()
4832
def test_asfortranarray1(self, dtype):
4933
def func(xp):
5034
x = xp.zeros((2, 3), dtype=dtype)
5135
ret = xp.asfortranarray(x)
5236
assert x.flags.c_contiguous
5337
assert ret.flags.f_contiguous
38+
if xp is cupy:
39+
return tuple(el * ret.itemsize for el in ret.strides)
40+
return ret.strides
5441

5542
assert func(numpy) == func(cupy)
5643

@@ -61,6 +48,9 @@ def func(xp):
6148
ret = xp.asfortranarray(x)
6249
assert x.flags.c_contiguous
6350
assert ret.flags.f_contiguous
51+
if xp is cupy:
52+
return tuple(el * ret.itemsize for el in ret.strides)
53+
return ret.strides
6454

6555
assert func(numpy) == func(cupy)
6656

@@ -71,6 +61,9 @@ def func(xp):
7161
ret = xp.asfortranarray(xp.asfortranarray(x))
7262
assert x.flags.c_contiguous
7363
assert ret.flags.f_contiguous
64+
if xp is cupy:
65+
return tuple(el * ret.itemsize for el in ret.strides)
66+
return ret.strides
7467

7568
assert func(numpy) == func(cupy)
7669

@@ -81,6 +74,9 @@ def func(xp):
8174
x = xp.transpose(x, (1, 0))
8275
ret = xp.asfortranarray(x)
8376
assert ret.flags.f_contiguous
77+
if xp is cupy:
78+
return tuple(el * ret.itemsize for el in ret.strides)
79+
return ret.strides
8480

8581
assert func(numpy) == func(cupy)
8682

@@ -91,6 +87,9 @@ def func(xp):
9187
ret = xp.asfortranarray(x)
9288
assert x.flags.c_contiguous
9389
assert ret.flags.f_contiguous
90+
if xp is cupy:
91+
return tuple(el * ret.itemsize for el in ret.strides)
92+
return ret.strides
9493

9594
assert func(numpy) == func(cupy)
9695

0 commit comments

Comments
 (0)