Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update recently updated tests to run properly when no fp64 #2273

Merged
merged 4 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dpnp/tests/test_arraycreation.py
Original file line number Diff line number Diff line change
Expand Up @@ -924,9 +924,9 @@ def test_logspace_axis(axis):


def test_logspace_list_input():
res_np = numpy.logspace([0], [2], base=[5])
res_dp = dpnp.logspace([0], [2], base=[5])
assert_allclose(res_dp, res_np)
expected = numpy.logspace([0], [2], base=[5])
result = dpnp.logspace([0], [2], base=[5])
assert_dtype_allclose(result, expected)


@pytest.mark.parametrize(
Expand Down
16 changes: 8 additions & 8 deletions dpnp/tests/test_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@ def test_basic(self, kind, dtype):

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

result = dpnp.argsort(ia, axis=axis)
expected = numpy.argsort(a, axis=axis)
expected = numpy.argsort(a, axis=axis, kind="stable")
assert_array_equal(result, expected)

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

result = ia.argsort(axis=axis)
expected = a.argsort(axis=axis, kind="stable")
assert_array_equal(result, expected)
assert_dtype_allclose(result, expected)

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

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

result = dpnp.sort(ia, axis=axis)
expected = numpy.sort(a, axis=axis)
expected = numpy.sort(a, axis=axis, kind="stable")
assert_array_equal(result, expected)

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

Expand Down
Loading