Skip to content

Commit

Permalink
make things less obvious
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockmendel committed Feb 21, 2018
1 parent 88c9638 commit ba2d4ca
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pandas/tests/indexes/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from collections import defaultdict

import pandas.util.testing as tm
from pandas.core.dtypes.generic import ABCIndex
from pandas.core.dtypes.common import is_unsigned_integer_dtype
from pandas.core.indexes.api import Index, MultiIndex
from pandas.tests.indexes.common import Base
Expand Down Expand Up @@ -2319,8 +2320,9 @@ def test_ensure_index_from_sequences(self, data, names, expected):
'pow', 'rpow', 'mod', 'divmod'])
def test_generated_op_names(opname, indices):
index = indices
if type(index) is pd.Index and opname == 'rsub':
# method doesn't exist, see GH#19723
if isinstance(index, ABCIndex) and opname == 'rsub':
# pd.Index.__rsub__ does not exist; though the method does exist
# for subclasses. see GH#19723
return
opname = '__{name}__'.format(name=opname)
method = getattr(index, opname)
Expand Down

1 comment on commit ba2d4ca

@jreback
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consistently across the codebase is one of the most important things

we never use type(..) for instance checking

Please sign in to comment.