MCPcopy Index your code
hub / github.com/numpy/numpy / test_quantile_monotonic

Method test_quantile_monotonic

numpy/lib/tests/test_function_base.py:4077–4088  ·  view source on GitHub ↗
(self, method)

Source from the content-addressed store, hash-verified

4075
4076 @pytest.mark.parametrize("method", quantile_methods)
4077 def test_quantile_monotonic(self, method):
4078 # GH 14685
4079 # test that the return value of quantile is monotonic if p0 is ordered
4080 # Also tests that the boundary values are not mishandled.
4081 p0 = np.linspace(0, 1, 101)
4082 quantile = np.quantile(np.array([0, 1, 1, 2, 2, 3, 3, 4, 5, 5, 1, 1, 9, 9, 9,
4083 8, 8, 7]) * 0.1, p0, method=method)
4084 assert_equal(np.sort(quantile), quantile)
4085
4086 # Also test one where the number of data points is clearly divisible:
4087 quantile = np.quantile([0., 1., 2., 3.], p0, method=method)
4088 assert_equal(np.sort(quantile), quantile)
4089
4090 @hypothesis.given(
4091 arr=arrays(dtype=np.float64,

Callers

nothing calls this directly

Calls 3

assert_equalFunction · 0.90
linspaceMethod · 0.80
sortMethod · 0.45

Tested by

no test coverage detected