Skip to content

Commit 459298d

Browse files
committed
TST: Use isinstance for CategoricalIndex in assert_index_equal
1 parent 5d5d668 commit 459298d

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
@@ -35,6 +35,7 @@
3535
import pandas as pd
3636
from pandas import (
3737
Categorical,
38+
CategoricalIndex,
3839
DataFrame,
3940
DatetimeIndex,
4041
Index,
@@ -325,8 +326,8 @@ def _check_types(left, right, obj: str = "Index") -> None:
325326
try:
326327
mismatch = left._values != right._values
327328
except TypeError:
328-
if hasattr(left, "_internal_get_values") and hasattr(
329-
right, "_internal_get_values"
329+
if isinstance(left, CategoricalIndex) and isinstance(
330+
right, CategoricalIndex
330331
):
331332
mismatch = (
332333
left._internal_get_values() != right._internal_get_values()

0 commit comments

Comments
 (0)