Skip to content

Commit ba2d4ca

Browse files
committed
make things less obvious
1 parent 88c9638 commit ba2d4ca

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pandas/tests/indexes/test_base.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from collections import defaultdict
88

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

0 commit comments

Comments
 (0)