Skip to content

Commit c1c1879

Browse files
committed
add test cases for percentile refine for describe function
1 parent 3e08684 commit c1c1879

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# -*- encoding: utf-8 -*-
2+
3+
"""
4+
We test the describe_ndframe function.
5+
"""
6+
7+
import pytest
8+
import numpy as np
9+
10+
from pandas.core.methods.describe import _refine_percentiles
11+
12+
def test_refine_percentiles():
13+
"""
14+
Check the performance of the _refine_percentiles when multiple
15+
values are passed.
16+
"""
17+
18+
# by default 0.25, 0.50, 0.75 is returned
19+
# or, when None is passed return behavior is the same
20+
assert _refine_percentiles() == np.array([0.25, 0.5, 0.75])
21+
assert _refine_percentiles(percentiles = None) == np.array([0.25, 0.5, 0.75])
22+
23+
# when any value is passed, then the function should return
24+
percentiles_ = [0.3, 0.6]
25+
assert _refine_percentiles(percentiles_) == np.array(percentiles_)
26+
27+
# when a blank list is passed, then should return only 0.5
28+
assert _refine_percentiles(percentiles = []) == np.array([0.5])

0 commit comments

Comments
 (0)