diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2020-06-28 09:25:25 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-28 09:25:25 -0600 |
commit | ab37e1b29214bbfbe1fed28db68661160ca4acb6 (patch) | |
tree | 55f28266ccf5a81ef007b065b06feb9744050b80 | |
parent | 4d5b2558c275a4a46b6ab0c486536d8e779651ce (diff) | |
parent | ae09a5291ffc052b4444fba6f353c5020af6661e (diff) | |
download | numpy-ab37e1b29214bbfbe1fed28db68661160ca4acb6.tar.gz |
Merge pull request #16699 from seberg/maint-quantile-tests
MAINT: Fixup quantile tests to not use `np.float`
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index 5ccac62e4..eb2fc3311 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -3116,12 +3116,11 @@ class TestQuantile: 8, 8, 7]) * 0.1, p0) assert_equal(np.sort(quantile), quantile) - @hypothesis.given(arr=arrays(dtype=np.float, shape=st.integers(min_value=3, - max_value=1000), - elements=st.floats(allow_infinity=False, - allow_nan=False, - min_value=-1e300, - max_value=1e300))) + @hypothesis.given( + arr=arrays(dtype=np.float64, + shape=st.integers(min_value=3, max_value=1000), + elements=st.floats(allow_infinity=False, allow_nan=False, + min_value=-1e300, max_value=1e300))) def test_quantile_monotonic_hypo(self, arr): p0 = np.arange(0, 1, 0.01) quantile = np.quantile(arr, p0) @@ -3166,8 +3165,10 @@ class TestLerp: b=st.floats(allow_nan=False, allow_infinity=False, min_value=-1e300, max_value=1e300)) def test_lerp_symmetric(self, t, a, b): - # double subtraction is needed to remove the extra precision that t < 0.5 has - assert np.lib.function_base._lerp(a, b, 1 - (1 - t)) == np.lib.function_base._lerp(b, a, 1 - t) + # double subtraction is needed to remove the extra precision of t < 0.5 + left = np.lib.function_base._lerp(a, b, 1 - (1 - t)) + right = np.lib.function_base._lerp(b, a, 1 - t) + assert left == right def test_lerp_0d_inputs(self): a = np.array(2) |