From ba2d4ca3d43764697ff013b9b8057d0d91576a67 Mon Sep 17 00:00:00 2001 From: Brock Mendel Date: Tue, 20 Feb 2018 16:17:50 -0800 Subject: [PATCH] make things less obvious --- pandas/tests/indexes/test_base.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pandas/tests/indexes/test_base.py b/pandas/tests/indexes/test_base.py index 219bcb7e7c7bd..d7f185853ca45 100644 --- a/pandas/tests/indexes/test_base.py +++ b/pandas/tests/indexes/test_base.py @@ -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 @@ -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)