1+ from typing import Any
2+
13import numpy as np
2- from numpy import typing as npt # noqa: F401
34import pandas as pd
45from typing_extensions import (
5- Never ,
66 assert_type ,
77)
88
@@ -56,7 +56,7 @@ def test_sub_numpy_array() -> None:
5656 c = np .array ([1.1j , 2.2j , 4.1j ], np .complex128 )
5757
5858 if TYPE_CHECKING_INVALID_USAGE :
59- assert_type (left - b , Never )
59+ assert_type (left - b , Any ) # pyright: ignore[reportAssertTypeFailure]
6060 check (assert_type (left - i , "pd.Index[int]" ), pd .Index , np .integer )
6161 check (assert_type (left - f , "pd.Index[float]" ), pd .Index , np .floating )
6262 check (assert_type (left - c , "pd.Index[complex]" ), pd .Index , np .complexfloating )
@@ -65,11 +65,19 @@ def test_sub_numpy_array() -> None:
6565 # checking, where our `__rsub__` cannot override. At runtime, they return
6666 # `Index`es with the correct element type.
6767 if TYPE_CHECKING_INVALID_USAGE :
68- assert_type (b - left , Never )
69- check (assert_type (i - left , "npt.NDArray[np.int64]" ), pd .Index , np .integer )
70- check (assert_type (f - left , "npt.NDArray[np.float64]" ), pd .Index , np .floating )
68+ assert_type (b - left , Any ) # pyright: ignore[reportAssertTypeFailure]
69+ check (
70+ assert_type (i - left , Any ), # pyright: ignore[reportAssertTypeFailure]
71+ pd .Index ,
72+ np .integer ,
73+ )
74+ check (
75+ assert_type (f - left , Any ), # pyright: ignore[reportAssertTypeFailure]
76+ pd .Index ,
77+ np .floating ,
78+ )
7179 check (
72- assert_type (c - left , "npt.NDArray[np.complex128]" ),
80+ assert_type (c - left , Any ), # pyright: ignore[reportAssertTypeFailure]
7381 pd .Index ,
7482 np .complexfloating ,
7583 )
0 commit comments