Skip to content

Commit 5310eb6

Browse files
committed
add comments about why testing is special for mypy vs pyright
1 parent 53e2213 commit 5310eb6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/test_indexes.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
if TYPE_CHECKING:
2727
MYPY_CHECKING: bool = True
28+
# See test_sorted_and_list() where mypy and pyright do different
29+
# inference on sorted(pd.Index)
2830
if MYPY_CHECKING:
2931
from typing import Any
3032

@@ -728,6 +730,8 @@ def test_interval_index_tuples():
728730
def test_sorted_and_list() -> None:
729731
# GH 497
730732
i1 = pd.Index([3, 2, 1])
733+
# mypy infers sorted(i1) as list[Any], while pyright infers sorted(i1) as
734+
# list[SupportsRichComparison]
731735
check(
732736
assert_type(
733737
sorted(i1),

0 commit comments

Comments
 (0)