diff --git a/pandas/_testing/asserters.py b/pandas/_testing/asserters.py index d0a95e764472d..a5641465b0be0 100644 --- a/pandas/_testing/asserters.py +++ b/pandas/_testing/asserters.py @@ -571,20 +571,12 @@ def raise_assert_detail( if isinstance(left, np.ndarray): left = pprint_thing(left) - elif ( - isinstance(left, CategoricalDtype) - or isinstance(left, PandasDtype) - or isinstance(left, StringDtype) - ): + elif isinstance(left, (CategoricalDtype, PandasDtype, StringDtype)): left = repr(left) if isinstance(right, np.ndarray): right = pprint_thing(right) - elif ( - isinstance(right, CategoricalDtype) - or isinstance(right, PandasDtype) - or isinstance(right, StringDtype) - ): + elif isinstance(right, (CategoricalDtype, PandasDtype, StringDtype)): right = repr(right) msg += f""" diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 27672c82fdf15..30861fd533bc2 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -1648,7 +1648,7 @@ def _get_default_index_names( from pandas.core.indexes.multi import MultiIndex if names is not None: - if isinstance(names, str) or isinstance(names, int): + if isinstance(names, (int, str)): names = [names] if not isinstance(names, list) and names is not None: diff --git a/pyproject.toml b/pyproject.toml index 912833f15f9a6..eca46b9417fbe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -101,7 +101,6 @@ disable = [ # pylint type "R": refactor, for bad code smell "comparison-with-itself", - "consider-merging-isinstance", "consider-using-ternary", "consider-using-with", "cyclic-import",