From 09d254fd811f6dac09afac7d796492e3830c7925 Mon Sep 17 00:00:00 2001 From: Ash Vardanian <1983160+ashvardanian@users.noreply.github.com> Date: Mon, 14 Oct 2024 03:36:13 +0000 Subject: [PATCH] Fix: Rounding to closest in tests --- scripts/test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/test.py b/scripts/test.py index f43ddbef..364831d7 100644 --- a/scripts/test.py +++ b/scripts/test.py @@ -688,7 +688,7 @@ def test_dense_i8(ndim, metric, stats_fixture): expected_dt, expected = profile(baseline_kernel, a.astype(np.int64), b.astype(np.int64)) result_dt, result = profile(simd_kernel, a, b) - assert int(result) == int(expected), f"Expected {expected}, but got {result}" + assert round(float(result)) == round(float(expected)), f"Expected {expected}, but got {result}" collect_errors(metric, ndim, "int8", accurate, accurate_dt, expected, expected_dt, result, result_dt, stats_fixture) #! Fun fact: SciPy doesn't actually raise an `OverflowError` when overflow happens @@ -903,7 +903,7 @@ def test_intersect(dtype, first_length_bound, second_length_bound): expected = baseline_intersect(a, b) result = simd.intersect(a, b) - assert int(expected) == int(result), f"Missing {np.intersect1d(a, b)} from {a} and {b}" + assert round(float(expected)) == round(float(result)), f"Missing {np.intersect1d(a, b)} from {a} and {b}" @pytest.mark.skipif(not numpy_available, reason="NumPy is not installed")