From 30ded193da6fe4189dc799db1dac1330483354e2 Mon Sep 17 00:00:00 2001 From: viknesh-ai Date: Sun, 16 Aug 2026 10:28:42 +0530 Subject: [PATCH] Migrate tests/test_aampdist.py from npt.assert_almost_equal to npt.assert_allclose --- tests/test_aampdist.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/test_aampdist.py b/tests/test_aampdist.py index ed361a09d..29b86152e 100644 --- a/tests/test_aampdist.py +++ b/tests/test_aampdist.py @@ -44,9 +44,9 @@ def test_aampdist_vect(T_A, T_B): m = 3 for p in [1.0, 2.0, 3.0]: ref_aampdist_vect = naive.aampdist_vect(T_A, T_B, m, p=p) - comp_aampdist_vect = _aampdist_vect(T_A, T_B, m, p=p) + cmp_aampdist_vect = _aampdist_vect(T_A, T_B, m, p=p) - npt.assert_almost_equal(ref_aampdist_vect, comp_aampdist_vect) + npt.assert_allclose(cmp_aampdist_vect, ref_aampdist_vect, atol=1.5e-07) @pytest.mark.parametrize("T_A, T_B", test_data) @@ -54,9 +54,9 @@ def test_aampdist_vect(T_A, T_B): def test_aampdist_vect_percentage(T_A, T_B, percentage): m = 3 ref_aampdist_vect = naive.aampdist_vect(T_A, T_B, m, percentage=percentage) - comp_aampdist_vect = _aampdist_vect(T_A, T_B, m, percentage=percentage) + cmp_aampdist_vect = _aampdist_vect(T_A, T_B, m, percentage=percentage) - npt.assert_almost_equal(ref_aampdist_vect, comp_aampdist_vect) + npt.assert_allclose(cmp_aampdist_vect, ref_aampdist_vect, atol=1.5e-07) @pytest.mark.parametrize("T_A, T_B", test_data) @@ -64,9 +64,9 @@ def test_aampdist_vect_percentage(T_A, T_B, percentage): def test_aampdist_vect_k(T_A, T_B, k): m = 3 ref_aampdist_vect = naive.aampdist_vect(T_A, T_B, m, k=k) - comp_aampdist_vect = _aampdist_vect(T_A, T_B, m, k=k) + cmp_aampdist_vect = _aampdist_vect(T_A, T_B, m, k=k) - npt.assert_almost_equal(ref_aampdist_vect, comp_aampdist_vect) + npt.assert_allclose(cmp_aampdist_vect, ref_aampdist_vect, atol=1.5e-07) @pytest.mark.parametrize("T_A, T_B", test_data) @@ -74,9 +74,9 @@ def test_aampdist(T_A, T_B): m = 3 for p in [1.0, 2.0, 3.0]: ref_mpdist = naive.aampdist(T_A, T_B, m, p=p) - comp_mpdist = aampdist(T_A, T_B, m, p=p) + cmp_mpdist = aampdist(T_A, T_B, m, p=p) - npt.assert_almost_equal(ref_mpdist, comp_mpdist) + npt.assert_allclose(cmp_mpdist, ref_mpdist, atol=1.5e-07) @pytest.mark.parametrize("T_A, T_B", test_data) @@ -84,9 +84,9 @@ def test_aampdist(T_A, T_B): def test_aampdist_percentage(T_A, T_B, percentage): m = 3 ref_mpdist = naive.aampdist(T_A, T_B, m, percentage=percentage) - comp_mpdist = aampdist(T_A, T_B, m, percentage=percentage) + cmp_mpdist = aampdist(T_A, T_B, m, percentage=percentage) - npt.assert_almost_equal(ref_mpdist, comp_mpdist) + npt.assert_allclose(cmp_mpdist, ref_mpdist, atol=1.5e-07) @pytest.mark.parametrize("T_A, T_B", test_data) @@ -94,9 +94,9 @@ def test_aampdist_percentage(T_A, T_B, percentage): def test_aampdist_k(T_A, T_B, k): m = 3 ref_mpdist = naive.aampdist(T_A, T_B, m, k=k) - comp_mpdist = aampdist(T_A, T_B, m, k=k) + cmp_mpdist = aampdist(T_A, T_B, m, k=k) - npt.assert_almost_equal(ref_mpdist, comp_mpdist) + npt.assert_allclose(cmp_mpdist, ref_mpdist, atol=1.5e-07) @pytest.mark.filterwarnings("ignore:numpy.dtype size changed") @@ -109,6 +109,6 @@ def test_aampdisted(T_A, T_B, dask_cluster): m = 3 for p in [1.0, 2.0, 3.0]: ref_mpdist = naive.aampdist(T_A, T_B, m, p=p) - comp_mpdist = aampdisted(dask_client, T_A, T_B, m, p=p) + cmp_mpdist = aampdisted(dask_client, T_A, T_B, m, p=p) - npt.assert_almost_equal(ref_mpdist, comp_mpdist) + npt.assert_allclose(cmp_mpdist, ref_mpdist, atol=1.5e-07)