Skip to content

Commit fe8fe11

Browse files
committed
update tests
1 parent 5f1b083 commit fe8fe11

File tree

18 files changed

+186
-421
lines changed

18 files changed

+186
-421
lines changed

dpnp/dpnp_iface_libmath.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def erf(in_array1):
8181
x1_desc = dpnp.get_dpnp_descriptor(
8282
in_array1, copy_when_strides=False, copy_when_nondefault_queue=False
8383
)
84-
if x1_desc and dpnp.is_cuda_backend(in_array1):
84+
if x1_desc and not dpnp.is_cuda_backend(in_array1):
8585
return dpnp_erf(x1_desc).get_pyobj()
8686

8787
result = create_output_descriptor_py(

dpnp/random/dpnp_random_state.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ def __init__(self, seed=None, device=None, sycl_queue=None):
8282
device=device, sycl_queue=sycl_queue
8383
)
8484

85-
dpnp.not_implemented_for_cuda_backend(self._sycl_queue)
86-
8785
self._sycl_device = self._sycl_queue.sycl_device
8886

8987
is_cpu = self._sycl_device.is_cpu

tests/skipped_tests_cuda.tbl

Lines changed: 133 additions & 379 deletions
Large diffs are not rendered by default.

tests/test_arithmetic.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import unittest
22

33
import numpy
4+
import pytest
45

56
from tests.helper import has_support_aspect64
67
from tests.third_party.cupy import testing
@@ -9,6 +10,7 @@
910
class TestArithmetic(unittest.TestCase):
1011
@testing.for_float_dtypes()
1112
@testing.numpy_cupy_allclose()
13+
@pytest.mark.usefixtures("allow_fall_back_on_numpy")
1214
def test_modf_part1(self, xp, dtype):
1315
a = xp.array([-2.5, -1.5, -0.5, 0, 0.5, 1.5, 2.5], dtype=dtype)
1416
b, _ = xp.modf(a)
@@ -17,6 +19,7 @@ def test_modf_part1(self, xp, dtype):
1719

1820
@testing.for_float_dtypes()
1921
@testing.numpy_cupy_allclose()
22+
@pytest.mark.usefixtures("allow_fall_back_on_numpy")
2023
def test_modf_part2(self, xp, dtype):
2124
a = xp.array([-2.5, -1.5, -0.5, 0, 0.5, 1.5, 2.5], dtype=dtype)
2225
_, c = xp.modf(a)

tests/test_indexing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ class TestTakeAlongAxis:
718718
],
719719
)
720720
def test_argequivalent(self, func, argfunc, kwargs):
721-
a = dpnp.random.random(size=(3, 4, 5))
721+
a = dpnp.asarray(numpy.random.random(size=(3, 4, 5)))
722722

723723
for axis in list(range(a.ndim)) + [None]:
724724
a_func = func(a, axis=axis, **kwargs)

tests/test_logic.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,12 +396,15 @@ def test_elemwise_comparison(op, x1, x2, dtype):
396396
"sh2", [[12], [4, 8], [1, 8, 6]], ids=["(12,)", "(4, 8)", "(1, 8, 6)"]
397397
)
398398
def test_comparison_no_broadcast_with_shapes(op, sh1, sh2):
399-
x1, x2 = dpnp.random.randn(*sh1), dpnp.random.randn(*sh2)
399+
x1_np = numpy.random.randn(*sh1)
400+
x2_np = numpy.random.randn(*sh2)
401+
x1 = dpnp.asarray(x1_np)
402+
x2 = dpnp.asarray(x2_np)
400403

401404
# x1 OP x2
402405
with pytest.raises(ValueError):
403406
getattr(dpnp, op)(x1, x2)
404-
getattr(numpy, op)(x1.asnumpy(), x2.asnumpy())
407+
getattr(numpy, op)(x1_np, x2_np)
405408

406409

407410
@pytest.mark.parametrize(

tests/test_random.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def check_seed(self, dist_name, params):
4545
assert_allclose(a1, a2, rtol=1e-07, atol=0)
4646

4747

48+
@pytest.mark.usefixtures("allow_fall_back_on_numpy")
4849
@pytest.mark.parametrize(
4950
"func",
5051
[dpnp.random.chisquare, dpnp.random.rand, dpnp.random.randn],
@@ -61,6 +62,7 @@ def test_input_size(func):
6162
assert output_shape == res.shape
6263

6364

65+
@pytest.mark.usefixtures("allow_fall_back_on_numpy")
6466
@pytest.mark.parametrize(
6567
"func",
6668
[
@@ -82,6 +84,7 @@ def test_input_shape(func):
8284
assert shape == res.shape
8385

8486

87+
@pytest.mark.usefixtures("allow_fall_back_on_numpy")
8588
@pytest.mark.parametrize(
8689
"func",
8790
[
@@ -104,6 +107,7 @@ def test_check_output(func):
104107
assert dpnp.all(res < 1)
105108

106109

110+
@pytest.mark.usefixtures("allow_fall_back_on_numpy")
107111
@pytest.mark.parametrize(
108112
"func",
109113
[
@@ -130,6 +134,7 @@ def test_seed(func):
130134
assert_allclose(a1, a2, rtol=1e-07, atol=0)
131135

132136

137+
@pytest.mark.usefixtures("allow_fall_back_on_numpy")
133138
def test_randn_normal_distribution():
134139
"""
135140
Check the moments of the normal distribution sample obtained
@@ -667,6 +672,7 @@ def test_seed(self):
667672

668673

669674
@pytest.mark.skipif(not has_support_aspect64(), reason="Failed on Iris Xe")
675+
@pytest.mark.usefixtures("allow_fall_back_on_numpy")
670676
class TestDistributionsNormal(TestDistribution):
671677
def test_extreme_value(self):
672678
loc = 5
@@ -827,11 +833,13 @@ def test_seed(self):
827833
self.check_seed("rayleigh", {"scale": scale})
828834

829835

836+
@pytest.mark.usefixtures("allow_fall_back_on_numpy")
830837
class TestDistributionsStandardCauchy(TestDistribution):
831838
def test_seed(self):
832839
self.check_seed("standard_cauchy", {})
833840

834841

842+
@pytest.mark.usefixtures("allow_fall_back_on_numpy")
835843
class TestDistributionsStandardExponential(TestDistribution):
836844
def test_moments(self):
837845
shape = 0.8
@@ -867,6 +875,7 @@ def test_seed(self):
867875
self.check_seed("standard_gamma", {"shape": 0.0})
868876

869877

878+
@pytest.mark.usefixtures("allow_fall_back_on_numpy")
870879
class TestDistributionsStandardNormal(TestDistribution):
871880
def test_moments(self):
872881
expected_mean = 0.0
@@ -944,6 +953,7 @@ def test_seed(self):
944953

945954

946955
@pytest.mark.skipif(not has_support_aspect64(), reason="Failed on Iris Xe")
956+
@pytest.mark.usefixtures("allow_fall_back_on_numpy")
947957
class TestDistributionsUniform(TestDistribution):
948958
def test_extreme_value(self):
949959
low = 1.0
@@ -1070,6 +1080,7 @@ def test_seed(self):
10701080
self.check_seed("zipf", {"a": a})
10711081

10721082

1083+
@pytest.mark.usefixtures("allow_fall_back_on_numpy")
10731084
class TestPermutationsTestShuffle:
10741085
@pytest.mark.parametrize(
10751086
"dtype",

tests/test_sort.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ def test_complex(self, dtype):
366366
assert result.dtype == expected.dtype
367367

368368

369+
@pytest.mark.usefixtures("allow_fall_back_on_numpy")
369370
@pytest.mark.parametrize("kth", [0, 1], ids=["0", "1"])
370371
@pytest.mark.parametrize("dtype", get_all_dtypes(no_none=True))
371372
@pytest.mark.parametrize(

tests/test_statistics.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
)
1919

2020

21+
@pytest.mark.usefixtures("allow_fall_back_on_numpy")
2122
@pytest.mark.parametrize(
2223
"dtype", get_all_dtypes(no_none=True, no_bool=True, no_complex=True)
2324
)

tests/test_sycl_queue.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,7 @@ def test_out_2in_1out(func, data1, data2, device):
11901190
assert_sycl_queue_equal(result.sycl_queue, x2.sycl_queue)
11911191

11921192

1193+
@pytest.mark.usefixtures("allow_fall_back_on_numpy")
11931194
@pytest.mark.parametrize(
11941195
"device",
11951196
valid_devices,

0 commit comments

Comments
 (0)