@@ -264,17 +264,6 @@ def test_types_to_numpy() -> None:
264264 )
265265
266266
267- def test_index_arithmetic () -> None :
268- # GH 287
269- idx = pd .Index ([1 , 2.2 , 3 ], dtype = float )
270- check (assert_type (idx * 3 , "pd.Index[float]" ), pd .Index , np .float64 )
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 (3 * idx , "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-
277-
278267def test_range_index_union () -> None :
279268 check (
280269 assert_type (
@@ -845,9 +834,6 @@ def test_index_operators() -> None:
845834 i1 = pd .Index ([1 , 2 , 3 ])
846835 i2 = pd .Index ([4 , 5 , 6 ])
847836
848- check (assert_type (i1 // i2 , "pd.Index[int]" ), pd .Index )
849- check (assert_type (i1 // 10 , "pd.Index[int]" ), pd .Index )
850- check (assert_type (10 // i1 , "pd.Index[int]" ), pd .Index )
851837 check (assert_type (i1 ** i2 , "pd.Index[int]" ), pd .Index )
852838 check (assert_type (i1 ** 2 , "pd.Index[int]" ), pd .Index )
853839 check (assert_type (2 ** i1 , "pd.Index[int]" ), pd .Index )
@@ -1196,31 +1182,6 @@ def test_new() -> None:
11961182 )
11971183
11981184
1199- def test_timedelta_div () -> None :
1200- index = pd .Index ([pd .Timedelta (days = 1 )], dtype = "timedelta64[s]" )
1201- delta = dt .timedelta (1 )
1202-
1203- check (assert_type (index / delta , "pd.Index[float]" ), pd .Index , float )
1204- check (assert_type (index / [delta ], "pd.Index[float]" ), pd .Index , float )
1205- check (assert_type (index / 1 , pd .TimedeltaIndex ), pd .TimedeltaIndex , pd .Timedelta )
1206- check (assert_type (index / [1 ], pd .TimedeltaIndex ), pd .TimedeltaIndex , pd .Timedelta )
1207- check (assert_type (index // delta , "pd.Index[int]" ), pd .Index , np .longlong )
1208- check (assert_type (index // [delta ], "pd.Index[int]" ), pd .Index , int )
1209- check (assert_type (index // 1 , pd .TimedeltaIndex ), pd .TimedeltaIndex , pd .Timedelta )
1210- check (assert_type (index // [1 ], pd .TimedeltaIndex ), pd .TimedeltaIndex , pd .Timedelta )
1211-
1212- check (assert_type (delta / index , "pd.Index[float]" ), pd .Index , float )
1213- check (assert_type ([delta ] / index , "pd.Index[float]" ), pd .Index , float )
1214- check (assert_type (delta // index , "pd.Index[int]" ), pd .Index , np .longlong )
1215- check (assert_type ([delta ] // index , "pd.Index[int]" ), pd .Index , np .signedinteger )
1216-
1217- if TYPE_CHECKING_INVALID_USAGE :
1218- _0 = 1 / index # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
1219- _1 = [1 ] / index # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
1220- _2 = 1 // index # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
1221- _3 = [1 ] // index # type: ignore[operator] # pyright: ignore[reportOperatorIssue]
1222-
1223-
12241185def test_datetime_operators_builtin () -> None :
12251186 time = pd .date_range ("2022-01-01" , "2022-01-31" , freq = "D" )
12261187 check (assert_type (time + dt .timedelta (0 ), pd .DatetimeIndex ), pd .DatetimeIndex )
0 commit comments