Skip to content

IntervalIndex.get_loc doctest failing #24931

Closed
@TomAugspurger

Description

@TomAugspurger
$ pytest --doctest-modules pandas/core/indexes/interval.py  -k get_loc
========================================================================================================================================================================== test session starts ===========================================================================================================================================================================
platform darwin -- Python 3.7.2, pytest-4.1.0, py-1.6.0, pluggy-0.7.1
rootdir: /Users/taugspurger/sandbox/pandas, inifile: setup.cfg
plugins: xdist-1.23.2, repeat-0.7.0, forked-0.2, faulthandler-1.5.0, cov-2.6.0, hypothesis-3.59.1
collected 12 items / 11 deselected

pandas/core/indexes/interval.py F                                                                                                                                                                                                                                                                                                                                  [100%]

================================================================================================================================================================================ FAILURES ================================================================================================================================================================================
______________________________________________________________________________________________________________________________________________________ [doctest] pandas.core.indexes.interval.IntervalIndex.get_loc ______________________________________________________________________________________________________________________________________________________
735         ---------
736         >>> i1, i2 = pd.Interval(0, 1), pd.Interval(1, 2)
737         >>> index = pd.IntervalIndex([i1, i2])
738         >>> index.get_loc(1)
739         0
740
741         You can also supply an interval or an location for a point inside an
742         interval.
743
744         >>> index.get_loc(pd.Interval(0, 2))
Expected:
    array([0, 1], dtype=int64)
Got:
    slice(0, 2, None)

/Users/taugspurger/sandbox/pandas/pandas/core/indexes/interval.py:744: DocTestFailure
================================================================================================================================================================ 1 failed, 11 deselected in 0.02 seconds =================================================================================================================================================================

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions