summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Pitters <31857876+CloseChoice@users.noreply.github.com>2020-05-27 21:36:01 +0200
committerGitHub <noreply@github.com>2020-05-27 21:36:01 +0200
commita6bc717024da20632139db53211e3b09d63dd1ff (patch)
treec3fe2198c54aac0861d9a4bbee538280b675f62c
parenteddef438696729d40092e3f8dfaf939b38ec8d5d (diff)
downloadnumpy-a6bc717024da20632139db53211e3b09d63dd1ff.tar.gz
Update numpy/lib/tests/test_function_base.py
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
-rw-r--r--numpy/lib/tests/test_function_base.py10
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),