summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_function_base.py
diff options
context:
space:
mode:
authorabel <aoun@cerfacs.fr>2021-10-19 12:10:16 +0200
committerSebastian Berg <sebastian@sipsolutions.net>2021-11-04 14:50:27 -0500
commitab19ed256bf9b20340c92cebcfd6158241122c88 (patch)
tree4c0e4f39f7881475137aeddf164fff15d0f722b6 /numpy/lib/tests/test_function_base.py
parent303c12cfe7ad1b8b6ed5417c126857b29355b1fb (diff)
downloadnumpy-ab19ed256bf9b20340c92cebcfd6158241122c88.tar.gz
Fix _lerp
- some changes were unrelated to the PR and have been reverted, including, renaming and moving the logic around. - Also renamed _quantile_ureduce_func to its original name
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r--numpy/lib/tests/test_function_base.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py
index 4f0db7bdb..d59f3a85d 100644
--- a/numpy/lib/tests/test_function_base.py
+++ b/numpy/lib/tests/test_function_base.py
@@ -3486,8 +3486,8 @@ class TestLerp:
b = st.floats(allow_nan=False, allow_infinity=False,
min_value=-1e300, max_value=1e300))
def test_linear_interpolation_formula_monotonic(self, t0, t1, a, b):
- l0 = nfb._linear_interpolation_formula(a, b, t0)
- l1 = nfb._linear_interpolation_formula(a, b, t1)
+ l0 = nfb._lerp(a, b, t0)
+ l1 = nfb._lerp(a, b, t1)
if t0 == t1 or a == b:
assert l0 == l1 # uninteresting
elif (t0 < t1) == (a < b):
@@ -3503,9 +3503,9 @@ class TestLerp:
min_value=-1e300, max_value=1e300))
def test_linear_interpolation_formula_bounded(self, t, a, b):
if a <= b:
- assert a <= nfb._linear_interpolation_formula(a, b, t) <= b
+ assert a <= nfb._lerp(a, b, t) <= b
else:
- assert b <= nfb._linear_interpolation_formula(a, b, t) <= a
+ assert b <= nfb._lerp(a, b, t) <= a
@hypothesis.given(t=st.floats(allow_nan=False, allow_infinity=False,
min_value=0, max_value=1),
@@ -3515,15 +3515,15 @@ class TestLerp:
min_value=-1e300, max_value=1e300))
def test_linear_interpolation_formula_symmetric(self, t, a, b):
# double subtraction is needed to remove the extra precision of t < 0.5
- left = nfb._linear_interpolation_formula(a, b, 1 - (1 - t))
- right = nfb._linear_interpolation_formula(b, a, 1 - t)
+ left = nfb._lerp(a, b, 1 - (1 - t))
+ right = nfb._lerp(b, a, 1 - t)
assert left == right
def test_linear_interpolation_formula_0d_inputs(self):
a = np.array(2)
b = np.array(5)
t = np.array(0.2)
- assert nfb._linear_interpolation_formula(a, b, t) == 2.6
+ assert nfb._lerp(a, b, t) == 2.6
class TestMedian: