Skip to content

Commit 8aa59c3

Browse files
committed
parametrize test and update docs
1 parent 6f27b9a commit 8aa59c3

File tree

3 files changed

+58
-14
lines changed

3 files changed

+58
-14
lines changed

doc/source/api.rst

+44
Original file line numberDiff line numberDiff line change
@@ -1416,6 +1416,50 @@ Selecting
14161416
Index.slice_indexer
14171417
Index.slice_locs
14181418

1419+
.. _api.int64index:
1420+
1421+
Int64Index
1422+
----------
1423+
1424+
.. autosummary::
1425+
:toctree: generated/
1426+
:template: autosummary/class_without_autosummary.rst
1427+
1428+
Int64Index
1429+
1430+
.. _api.uint64index:
1431+
1432+
UInt64Index
1433+
-----------
1434+
1435+
.. autosummary::
1436+
:toctree: generated/
1437+
:template: autosummary/class_without_autosummary.rst
1438+
1439+
UInt64Index
1440+
1441+
.. _api.float64index:
1442+
1443+
Float64Index
1444+
------------
1445+
1446+
.. autosummary::
1447+
:toctree: generated/
1448+
:template: autosummary/class_without_autosummary.rst
1449+
1450+
Float64Index
1451+
1452+
.. _api.rangeindex:
1453+
1454+
RangeIndex
1455+
----------
1456+
1457+
.. autosummary::
1458+
:toctree: generated/
1459+
:template: autosummary/class_without_autosummary.rst
1460+
1461+
RangeIndex
1462+
14191463
.. _api.categoricalindex:
14201464

14211465
CategoricalIndex

doc/source/whatsnew/v0.21.0.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ Performance Improvements
473473
- Improved performance of :meth:`Categorical.set_categories` by not materializing the values (:issue:`17508`)
474474
- :attr:`Timestamp.microsecond` no longer re-computes on attribute access (:issue:`17331`)
475475
- Improved performance of the :class:`CategoricalIndex` for data that is already categorical dtype (:issue:`17513`)
476-
- Improved performance of ``RangeIndex.min`` and ``RangeIndex.max`` by using ``RangeIndex`` properties to perform the computations (:issue:`17607`)
476+
- Improved performance of :meth:`RangeIndex.min` and :meth:`RangeIndex.max` by using ``RangeIndex`` properties to perform the computations (:issue:`17607`)
477477

478478
.. _whatsnew_0210.bug_fixes:
479479

pandas/tests/indexes/test_range.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -995,21 +995,21 @@ def test_append(self):
995995
result2 = indices[0].append(indices[1])
996996
tm.assert_index_equal(result2, expected, exact=True)
997997

998-
def test_max_min(self):
999-
params = [(0, 400, 3), (500, 0, -6), (-10**6, 10**6, 4),
1000-
(10**6, -10**6, -4), (0, 10, 20)]
1001-
for start, stop, step in params:
1002-
idx = RangeIndex(start, stop, step)
1003-
1004-
expected = idx._int64index.max()
1005-
result = idx.max()
1006-
assert result == expected
998+
@pytest.mark.parametrize('start,stop,step',
999+
[(0, 400, 3), (500, 0, -6), (-10**6, 10**6, 4),
1000+
(10**6, -10**6, -4), (0, 10, 20)])
1001+
def test_max_min(self, start, stop, step):
1002+
# GH17607
1003+
idx = RangeIndex(start, stop, step)
1004+
expected = idx._int64index.max()
1005+
result = idx.max()
1006+
assert result == expected
10071007

1008-
expected = idx._int64index.min()
1009-
result = idx.min()
1010-
assert result == expected
1008+
expected = idx._int64index.min()
1009+
result = idx.min()
1010+
assert result == expected
10111011

10121012
# empty
1013-
idx = RangeIndex(0, 1, -1)
1013+
idx = RangeIndex(start, stop, -step)
10141014
assert isna(idx.max())
10151015
assert isna(idx.min())

0 commit comments

Comments
 (0)