diff options
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 10 |
1 files changed, 8 insertions, 2 deletions
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), |