Skip to content

Commit 2ba4cfb

Browse files
committed
TST: Use isinstance for CategoricalIndex in assert_index_equal
1 parent db8006d commit 2ba4cfb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pandas/_testing/asserters.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import pandas as pd
3939
from pandas import (
4040
Categorical,
41+
CategoricalIndex,
4142
DataFrame,
4243
DatetimeIndex,
4344
Index,
@@ -328,8 +329,8 @@ def _check_types(left, right, obj: str = "Index") -> None:
328329
try:
329330
mismatch = left._values != right._values
330331
except TypeError:
331-
if hasattr(left, "_internal_get_values") and hasattr(
332-
right, "_internal_get_values"
332+
if isinstance(left, CategoricalIndex) and isinstance(
333+
right, CategoricalIndex
333334
):
334335
mismatch = (
335336
left._internal_get_values() != right._internal_get_values()

0 commit comments

Comments
 (0)