From 5c82abfa08aa1d0b99dd1f9f61461a713d44d6cb Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Mon, 25 Mar 2024 22:05:38 +0100 Subject: [PATCH] Corrected test_argsort_ndarray test with unique generated random values --- tests/test_sort.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/test_sort.py b/tests/test_sort.py index 6e9c5b9fd55..e9e8afb4454 100644 --- a/tests/test_sort.py +++ b/tests/test_sort.py @@ -47,7 +47,12 @@ def test_argsort_axis(self, axis): @pytest.mark.parametrize("dtype", get_all_dtypes()) @pytest.mark.parametrize("axis", [None, -2, -1, 0, 1]) def test_argsort_ndarray(self, dtype, axis): - a = numpy.random.uniform(-10, 10, 12) + if dtype and issubclass(dtype, numpy.integer): + a = numpy.random.choice( + numpy.arange(-10, 10), replace=False, size=12 + ) + else: + a = numpy.random.uniform(-10, 10, 12) np_array = numpy.array(a, dtype=dtype).reshape(6, 2) dp_array = dpnp.array(np_array)