Skip to content

TST: tests comparison on numpy master #17046

Closed
@jreback

Description

@jreback

https://travis-ci.org/pandas-dev/pandas/jobs/256013691

this was working a few builds ago. I think maybe some random sorting details, IOW how exactly argsort works can make this fail with either '>' or '<'. so ok with changing test to accept either.

________________________ TestMixedIntIndex.test_argsort ________________________
[gw1] linux -- Python 3.6.2 /home/travis/miniconda3/envs/pandas/bin/python
self = <pandas.tests.indexes.test_base.TestMixedIntIndex object at 0x7fe54ca566a0>
    def test_argsort(self):
        idx = self.create_index()
        if PY36:
            with tm.assert_raises_regex(TypeError, "'>' not supported"):
>               result = idx.argsort()
pandas/tests/indexes/test_base.py:1850: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pandas/util/testing.py:2493: in __exit__
    return self.exception_matches(exc_type, exc_value, trace_back)
pandas/util/testing.py:2528: in exception_matches
    raise_with_traceback(e, trace_back)
pandas/compat/__init__.py:343: in raise_with_traceback
    raise exc.with_traceback(traceback)
pandas/tests/indexes/test_base.py:1850: in test_argsort
    result = idx.argsort()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = Index([0, 'a', 1, 'b', 2, 'c'], dtype='object'), args = (), kwargs = {}
result = array([0, 'a', 1, 'b', 2, 'c'], dtype=object)
    def argsort(self, *args, **kwargs):
        """
            Returns the indices that would sort the index and its
            underlying data.
    
            Returns
            -------
            argsorted : numpy array
    
            See also
            --------
            numpy.ndarray.argsort
            """
        result = self.asi8
        if result is None:
            result = np.array(self)
>       return result.argsort(*args, **kwargs)
E       AssertionError: "'>' not supported" does not match "'<' not supported between instances of 'str' and 'int'"
pandas/core/indexes/base.py:2102: AssertionError

Metadata

Metadata

Assignees

No one assigned

    Labels

    Testingpandas testing functions or related to the test suite

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions