From 002df0e20f109dd001053f42bdc9a90632f536ff Mon Sep 17 00:00:00 2001 From: Pal Barta Date: Wed, 10 Aug 2022 11:20:50 -0400 Subject: TST: fix test_linear_interpolation_formula_symmetric The lerp test compared the output of the original and the symmetric functions by using basic assertion. Double precision errors could accumulate in a way that the 2 outputs mismatch by epsilon. For more information on the precision issue, see #22073 Fix: use assert_allclose instead for float comparison. --- numpy/lib/tests/test_function_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/lib') diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index 8457551ca..56081b4f0 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -3579,7 +3579,7 @@ class TestLerp: # double subtraction is needed to remove the extra precision of t < 0.5 left = nfb._lerp(a, b, 1 - (1 - t)) right = nfb._lerp(b, a, 1 - t) - assert left == right + assert_allclose(left, right) def test_linear_interpolation_formula_0d_inputs(self): a = np.array(2) -- cgit v1.2.1