@@ -265,17 +265,6 @@ def test_types_to_numpy() -> None:
265265 )
266266
267267
268- def test_index_arithmetic () -> None :
269- # GH 287
270- idx = pd .Index ([1 , 2.2 , 3 ], dtype = float )
271- check (assert_type (idx * 3 , "pd.Index[float]" ), pd .Index , np .float64 )
272- check (assert_type (idx / 3 , "pd.Index[float]" ), pd .Index , np .float64 )
273- check (assert_type (idx // 3 , "pd.Index[float]" ), pd .Index , np .float64 )
274- check (assert_type (3 * idx , "pd.Index[float]" ), pd .Index , np .float64 )
275- check (assert_type (3 / idx , "pd.Index[float]" ), pd .Index , np .float64 )
276- check (assert_type (3 // idx , "pd.Index[float]" ), pd .Index , np .float64 )
277-
278-
279268def test_range_index_union () -> None :
280269 check (
281270 assert_type (
@@ -846,9 +835,6 @@ def test_index_operators() -> None:
846835 i1 = pd .Index ([1 , 2 , 3 ])
847836 i2 = pd .Index ([4 , 5 , 6 ])
848837
849- check (assert_type (i1 // i2 , "pd.Index[int]" ), pd .Index )
850- check (assert_type (i1 // 10 , "pd.Index[int]" ), pd .Index )
851- check (assert_type (10 // i1 , "pd.Index[int]" ), pd .Index )
852838 check (assert_type (i1 ** i2 , "pd.Index[int]" ), pd .Index )
853839 check (assert_type (i1 ** 2 , "pd.Index[int]" ), pd .Index )
854840 check (assert_type (2 ** i1 , "pd.Index[int]" ), pd .Index )
@@ -1197,31 +1183,6 @@ def test_new() -> None:
11971183 )
11981184
11991185
1200- def test_timedelta_div () -> None :
1201- index = pd .Index ([pd .Timedelta (days = 1 )], dtype = "timedelta64[s]" )
1202- delta = dt .timedelta (1 )
1203-
1204- check (assert_type (index / delta , "pd.Index[float]" ), pd .Index , float )
1205- check (assert_type (index / [delta ], "pd.Index[float]" ), pd .Index , float )
1206- check (assert_type (index / 1 , pd .TimedeltaIndex ), pd .TimedeltaIndex , pd .Timedelta )
1207- check (assert_type (index / [1 ], pd .TimedeltaIndex ), pd .TimedeltaIndex , pd .Timedelta )
1208- check (assert_type (index // delta , "pd.Index[int]" ), pd .Index , np .longlong )
1209- check (assert_type (index // [delta ], "pd.Index[int]" ), pd .Index , int )
1210- check (assert_type (index // 1 , pd .TimedeltaIndex ), pd .TimedeltaIndex , pd .Timedelta )
1211- check (assert_type (index // [1 ], pd .TimedeltaIndex ), pd .TimedeltaIndex , pd .Timedelta )
1212-
1213- check (assert_type (delta / index , "pd.Index[float]" ), pd .Index , float )
1214- check (assert_type ([delta ] / index , "pd.Index[float]" ), pd .Index , float )
1215- check (assert_type (delta // index , "pd.Index[int]" ), pd .Index , np .longlong )
1216- check (assert_type ([delta ] // index , "pd.Index[int]" ), pd .Index , np .signedinteger )
1217-
1218- if TYPE_CHECKING_INVALID_USAGE :
1219- _0 = 1 / index # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
1220- _1 = [1 ] / index # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
1221- _2 = 1 // index # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
1222- _3 = [1 ] // index # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
1223-
1224-
12251186def test_datetime_operators_builtin () -> None :
12261187 time = pd .date_range ("2022-01-01" , "2022-01-31" , freq = "D" )
12271188 check (assert_type (time + dt .timedelta (0 ), pd .DatetimeIndex ), pd .DatetimeIndex )
0 commit comments