From a6bc717024da20632139db53211e3b09d63dd1ff Mon Sep 17 00:00:00 2001 From: Tobias Pitters <31857876+CloseChoice@users.noreply.github.com> Date: Wed, 27 May 2020 21:36:01 +0200 Subject: Update numpy/lib/tests/test_function_base.py Co-authored-by: Eric Wieser --- numpy/lib/tests/test_function_base.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'numpy/lib/tests/test_function_base.py') diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index 5468901b4..f6c735264 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -3135,8 +3135,14 @@ class TestLerp: b= st.floats(allow_nan=False, allow_infinity=False, width=32)) def test_lerp_monotonic(self, t0, t1, a, b): - assert (np.lib.function_base._lerp(a, b, t1) - - np.lib.function_base._lerp(a, b, t0)) * (b - a) * (t1 - t0) >= 0 + l0 = np.lib.function_base._lerp(a, b, t0) + l1 = np.lib.function_base._lerp(a, b, t1) + if t0 == t1 or a == b: + assert l0 == l1 # uninteresting + elif (t0 < t1) == (a < b): + assert l0 < l1 + else: + assert l0 > l1 @hypothesis.given(t=st.floats(allow_nan=False, allow_infinity=False, min_value=0, max_value=1), -- cgit v1.2.1