diff --git a/pandas/tests/reductions/test_describe_ndframe.py b/pandas/tests/reductions/test_describe_ndframe.py index 9bb45f3ae68ca..ec252fd4316f5 100644 --- a/pandas/tests/reductions/test_describe_ndframe.py +++ b/pandas/tests/reductions/test_describe_ndframe.py @@ -4,25 +4,22 @@ We test the describe_ndframe function. """ -import pytest import numpy as np +import pytest from pandas.core.methods.describe import _refine_percentiles -def test_refine_percentiles(): +@pytest.mark.parametrize( + "percentiles_, expected", [ + (None, np.array([0.25, 0.5, 0.75])), + ([], np.array([0.5])), + ([0.3, 0.6], np.array([0.3, 0.6])), + ] +) +def test_refine_percentiles(percentiles_, expected): """ Check the performance of the _refine_percentiles when multiple values are passed. """ - # by default 0.25, 0.50, 0.75 is returned - # or, when None is passed return behavior is the same - assert _refine_percentiles() == np.array([0.25, 0.5, 0.75]) - assert _refine_percentiles(percentiles = None) == np.array([0.25, 0.5, 0.75]) - - # when any value is passed, then the function should return - percentiles_ = [0.3, 0.6] - assert _refine_percentiles(percentiles_) == np.array(percentiles_) - - # when a blank list is passed, then should return only 0.5 - assert _refine_percentiles(percentiles = []) == np.array([0.5]) + assert np.array_equal(_refine_percentiles(percentiles_), expected)