@@ -31,15 +31,17 @@ def test_mul_py_scalar(left: "pd.Index[str]") -> None:
31
31
b , i , f , c = True , 1 , 1.0 , 1j
32
32
s , d = datetime (2025 , 9 , 27 ), timedelta (seconds = 1 )
33
33
34
- check (assert_type (left * b , "pd.Index[str]" ), pd .Index , str )
34
+ if TYPE_CHECKING_INVALID_USAGE :
35
+ _00 = left * b # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
35
36
check (assert_type (left * i , "pd.Index[str]" ), pd .Index , str )
36
37
if TYPE_CHECKING_INVALID_USAGE :
37
38
_03 = left * f # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
38
39
_04 = left * c # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
39
40
_05 = left * s # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
40
41
_06 = left * d # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
41
42
42
- check (assert_type (b * left , "pd.Index[str]" ), pd .Index , str )
43
+ if TYPE_CHECKING_INVALID_USAGE :
44
+ _10 = b * left # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
43
45
check (assert_type (i * left , "pd.Index[str]" ), pd .Index , str )
44
46
if TYPE_CHECKING_INVALID_USAGE :
45
47
_13 = f * left # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
@@ -54,15 +56,17 @@ def test_mul_py_sequence(left: "pd.Index[str]") -> None:
54
56
s = [datetime (2025 , 9 , d ) for d in (27 , 28 , 29 )]
55
57
d = [timedelta (seconds = s + 1 ) for s in range (3 )]
56
58
57
- check (assert_type (left * b , "pd.Index[str]" ), pd .Index , str )
59
+ if TYPE_CHECKING_INVALID_USAGE :
60
+ _00 = left * b # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
58
61
check (assert_type (left * i , "pd.Index[str]" ), pd .Index , str )
59
62
if TYPE_CHECKING_INVALID_USAGE :
60
63
_03 = left * f # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
61
64
_04 = left * c # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
62
65
_05 = left * s # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
63
66
_06 = left * d # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
64
67
65
- check (assert_type (b * left , "pd.Index[str]" ), pd .Index , str )
68
+ if TYPE_CHECKING_INVALID_USAGE :
69
+ _10 = b * left # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
66
70
check (assert_type (i * left , "pd.Index[str]" ), pd .Index , str )
67
71
if TYPE_CHECKING_INVALID_USAGE :
68
72
_13 = f * left # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
@@ -80,7 +84,8 @@ def test_mul_numpy_array(left: "pd.Index[str]") -> None:
80
84
s = np .array ([np .datetime64 (f"2025-09-{ d } " ) for d in (27 , 28 , 29 )], np .datetime64 )
81
85
d = np .array ([np .timedelta64 (s + 1 , "s" ) for s in range (3 )], np .timedelta64 )
82
86
83
- check (assert_type (left * b , "pd.Index[str]" ), pd .Index , str )
87
+ if TYPE_CHECKING_INVALID_USAGE :
88
+ assert_type (left * b , Never )
84
89
check (assert_type (left * i , "pd.Index[str]" ), pd .Index , str )
85
90
if TYPE_CHECKING_INVALID_USAGE :
86
91
assert_type (left * f , Never )
@@ -91,7 +96,8 @@ def test_mul_numpy_array(left: "pd.Index[str]") -> None:
91
96
# `numpy` typing gives the corresponding `ndarray`s in the static type
92
97
# checking, where our `__rmul__` cannot override. At runtime, they return
93
98
# `Index` with the correct element type.
94
- check (assert_type (b * left , "npt.NDArray[np.bool_]" ), pd .Index , str )
99
+ if TYPE_CHECKING_INVALID_USAGE :
100
+ assert_type (b * left , "npt.NDArray[np.bool_]" )
95
101
check (assert_type (i * left , "npt.NDArray[np.int64]" ), pd .Index , str )
96
102
if TYPE_CHECKING_INVALID_USAGE :
97
103
assert_type (f * left , "npt.NDArray[np.float64]" )
@@ -109,15 +115,17 @@ def test_mul_pd_index(left: "pd.Index[str]") -> None:
109
115
s = pd .Index ([datetime (2025 , 9 , d ) for d in (27 , 28 , 29 )])
110
116
d = pd .Index ([timedelta (seconds = s + 1 ) for s in range (3 )])
111
117
112
- check (assert_type (left * b , "pd.Index[str]" ), pd .Index , str )
118
+ if TYPE_CHECKING_INVALID_USAGE :
119
+ _00 = left * b # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
113
120
check (assert_type (left * i , "pd.Index[str]" ), pd .Index , str )
114
121
if TYPE_CHECKING_INVALID_USAGE :
115
122
_03 = left * f # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
116
123
_04 = left * c # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
117
124
_05 = left * s # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
118
125
_06 = left * d # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
119
126
120
- check (assert_type (b * left , "pd.Index[str]" ), pd .Index , str )
127
+ if TYPE_CHECKING_INVALID_USAGE :
128
+ _10 = b * left # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
121
129
check (assert_type (i * left , "pd.Index[str]" ), pd .Index , str )
122
130
if TYPE_CHECKING_INVALID_USAGE :
123
131
_13 = f * left # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
0 commit comments