From d6f2b0012e38d0d54d75c11abafab8a1525a0a96 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Mon, 18 Nov 2024 16:50:02 +0100 Subject: [PATCH 1/2] Add seeding before generating random data in faulty tests --- dpnp/tests/test_mathematical.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dpnp/tests/test_mathematical.py b/dpnp/tests/test_mathematical.py index 906489760162..f3ddda3c4552 100644 --- a/dpnp/tests/test_mathematical.py +++ b/dpnp/tests/test_mathematical.py @@ -22,6 +22,7 @@ from .helper import ( assert_dtype_allclose, + generate_random_numpy_array, get_all_dtypes, get_complex_dtypes, get_float_complex_dtypes, @@ -2321,7 +2322,7 @@ def test_basic(self, dt): "dt", get_all_dtypes(no_none=True, no_complex=True) ) def test_rand(self, dt): - a = numpy.random.rand(10) * 100 + a = generate_random_numpy_array(10, seed_value=42) * 100 a = a.astype(dtype=dt) ia = dpnp.array(a) @@ -3429,6 +3430,7 @@ def test_basic(self, array, val, data_type, val_type): @pytest.mark.parametrize("dtype", get_all_dtypes()) def test_power(self, dtype): + numpy.random.seed(42) np_array1, np_array2, expected = _get_numpy_arrays_2in_1out( "power", dtype, [0, 10, 10] ) From da63cd407d8862da05be0495679a8494dd32a80e Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Mon, 18 Nov 2024 17:41:44 +0100 Subject: [PATCH 2/2] Update test_rand_period --- dpnp/tests/test_mathematical.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dpnp/tests/test_mathematical.py b/dpnp/tests/test_mathematical.py index f3ddda3c4552..baa9c60310c2 100644 --- a/dpnp/tests/test_mathematical.py +++ b/dpnp/tests/test_mathematical.py @@ -2322,7 +2322,7 @@ def test_basic(self, dt): "dt", get_all_dtypes(no_none=True, no_complex=True) ) def test_rand(self, dt): - a = generate_random_numpy_array(10, seed_value=42) * 100 + a = generate_random_numpy_array((10,), seed_value=42) * 100 a = a.astype(dtype=dt) ia = dpnp.array(a) @@ -2346,7 +2346,7 @@ def test_period(self, dt): "dt", get_all_dtypes(no_none=True, no_bool=True, no_complex=True) ) def test_rand_period(self, dt): - a = numpy.random.rand(10) * 1000 + a = generate_random_numpy_array((10,), seed_value=42) * 1000 a = a.astype(dtype=dt) ia = dpnp.array(a)