Skip to content

Commit 451c2b3

Browse files
authored
Update recently updated tests to run properly when no fp64 (#2273)
Some of the tests which were updated by latest PRs don't work properly when running on a device without fp64 support. The PR is intended to resolve that and to implement proper check of the resulting arrays for impacted tests.
1 parent 094ab7c commit 451c2b3

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

dpnp/tests/test_arraycreation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -924,9 +924,9 @@ def test_logspace_axis(axis):
924924

925925

926926
def test_logspace_list_input():
927-
res_np = numpy.logspace([0], [2], base=[5])
928-
res_dp = dpnp.logspace([0], [2], base=[5])
929-
assert_allclose(res_dp, res_np)
927+
expected = numpy.logspace([0], [2], base=[5])
928+
result = dpnp.logspace([0], [2], base=[5])
929+
assert_dtype_allclose(result, expected)
930930

931931

932932
@pytest.mark.parametrize(

dpnp/tests/test_sort.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,22 @@ def test_basic(self, kind, dtype):
3131

3232
@pytest.mark.parametrize("axis", [None, -2, -1, 0, 1, 2])
3333
def test_axis(self, axis):
34-
a = generate_random_numpy_array((3, 4, 3))
34+
a = generate_random_numpy_array((3, 4, 3), dtype="i8")
3535
ia = dpnp.array(a)
3636

3737
result = dpnp.argsort(ia, axis=axis)
38-
expected = numpy.argsort(a, axis=axis)
38+
expected = numpy.argsort(a, axis=axis, kind="stable")
3939
assert_array_equal(result, expected)
4040

4141
@pytest.mark.parametrize("dtype", get_all_dtypes(no_none=True))
4242
@pytest.mark.parametrize("axis", [None, -2, -1, 0, 1])
43-
def test_ndarray(self, dtype, axis):
43+
def test_ndarray_method(self, dtype, axis):
4444
a = generate_random_numpy_array((6, 2), dtype)
4545
ia = dpnp.array(a)
4646

4747
result = ia.argsort(axis=axis)
4848
expected = a.argsort(axis=axis, kind="stable")
49-
assert_array_equal(result, expected)
49+
assert_dtype_allclose(result, expected)
5050

5151
# this test validates that all different options of kind in dpnp are stable
5252
@pytest.mark.parametrize("kind", [None, "stable", "mergesort", "radixsort"])
@@ -291,16 +291,16 @@ def test_basic(self, kind, dtype):
291291

292292
@pytest.mark.parametrize("axis", [None, -2, -1, 0, 1, 2])
293293
def test_axis(self, axis):
294-
a = generate_random_numpy_array((3, 4, 3))
294+
a = generate_random_numpy_array((3, 4, 3), dtype="i8")
295295
ia = dpnp.array(a)
296296

297297
result = dpnp.sort(ia, axis=axis)
298-
expected = numpy.sort(a, axis=axis)
298+
expected = numpy.sort(a, axis=axis, kind="stable")
299299
assert_array_equal(result, expected)
300300

301-
@pytest.mark.parametrize("dtype", get_all_dtypes())
301+
@pytest.mark.parametrize("dtype", get_all_dtypes(no_none=True))
302302
@pytest.mark.parametrize("axis", [-2, -1, 0, 1])
303-
def test_ndarray(self, dtype, axis):
303+
def test_ndarray_method(self, dtype, axis):
304304
a = generate_random_numpy_array((6, 2), dtype)
305305
ia = dpnp.array(a)
306306

0 commit comments

Comments
 (0)