|
12 | 12 | import string
|
13 | 13 | import tempfile
|
14 | 14 | import traceback
|
| 15 | +from typing import Union, cast |
15 | 16 | import warnings
|
16 | 17 | import zipfile
|
17 | 18 |
|
@@ -515,9 +516,14 @@ def equalContents(arr1, arr2):
|
515 | 516 | return frozenset(arr1) == frozenset(arr2)
|
516 | 517 |
|
517 | 518 |
|
518 |
| -def assert_index_equal(left, right, exact='equiv', check_names=True, |
519 |
| - check_less_precise=False, check_exact=True, |
520 |
| - check_categorical=True, obj='Index'): |
| 519 | +def assert_index_equal(left: Index, |
| 520 | + right: Index, |
| 521 | + exact: Union[bool, str] = 'equiv', |
| 522 | + check_names: bool = True, |
| 523 | + check_less_precise: Union[bool, int] = False, |
| 524 | + check_exact: bool = True, |
| 525 | + check_categorical: bool = True, |
| 526 | + obj: str = 'Index') -> None: |
521 | 527 | """Check that left and right Index are equal.
|
522 | 528 |
|
523 | 529 | Parameters
|
@@ -588,6 +594,9 @@ def _get_ilevel_values(index, level):
|
588 | 594 |
|
589 | 595 | # MultiIndex special comparison for little-friendly error messages
|
590 | 596 | if left.nlevels > 1:
|
| 597 | + left = cast(MultiIndex, left) |
| 598 | + right = cast(MultiIndex, right) |
| 599 | + |
591 | 600 | for level in range(left.nlevels):
|
592 | 601 | # cannot use get_level_values here because it can change dtype
|
593 | 602 | llevel = _get_ilevel_values(left, level)
|
|
0 commit comments