Skip to content

Commit 98cf811

Browse files
bzahseberg
authored andcommitted
TST: Add extrapolation tests
1 parent 8413b5a commit 98cf811

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

numpy/lib/tests/test_function_base.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3032,6 +3032,15 @@ def test_nearest(self, dtype):
30323032
assert_equal(np.percentile(np.arange(10, dtype=dtype), 49,
30333033
interpolation='nearest'), 4)
30343034

3035+
def test_linear_interpolation_extrapolation(self):
3036+
arr = np.random.rand(5)
3037+
3038+
actual = np.percentile(arr, 100)
3039+
np.testing.assert_equal(actual, arr.max())
3040+
3041+
actual = np.percentile(arr, 0)
3042+
np.testing.assert_equal(actual, arr.min())
3043+
30353044
def test_sequence(self):
30363045
x = np.arange(8) * 0.5
30373046
assert_equal(np.percentile(x, [0, 100, 50]), [0, 3.5, 1.75])

0 commit comments

Comments
 (0)