21
21
Index ,
22
22
IntervalIndex ,
23
23
Series ,
24
- Timedelta ,
25
- Timestamp ,
26
24
period_range ,
27
25
)
28
26
import pandas ._testing as tm
@@ -1276,27 +1274,6 @@ def test_interval_can_hold_element(self, dtype, element):
1276
1274
self .check_series_setitem (elem , ii , True )
1277
1275
assert blk ._can_hold_element (elem )
1278
1276
1279
- # Careful: to get the expected Series-inplace behavior we need
1280
- # `elem` to not have the same length as `arr`
1281
- ii2 = IntervalIndex .from_breaks (arr [:- 1 ], closed = "neither" )
1282
- elem = element (ii2 )
1283
- msg = "Setting an item of incompatible dtype is deprecated"
1284
- with tm .assert_produces_warning (FutureWarning , match = msg ):
1285
- self .check_series_setitem (elem , ii , False )
1286
- assert not blk ._can_hold_element (elem )
1287
-
1288
- ii3 = IntervalIndex .from_breaks ([Timestamp (1 ), Timestamp (3 ), Timestamp (4 )])
1289
- elem = element (ii3 )
1290
- with tm .assert_produces_warning (FutureWarning , match = msg ):
1291
- self .check_series_setitem (elem , ii , False )
1292
- assert not blk ._can_hold_element (elem )
1293
-
1294
- ii4 = IntervalIndex .from_breaks ([Timedelta (1 ), Timedelta (3 ), Timedelta (4 )])
1295
- elem = element (ii4 )
1296
- with tm .assert_produces_warning (FutureWarning , match = msg ):
1297
- self .check_series_setitem (elem , ii , False )
1298
- assert not blk ._can_hold_element (elem )
1299
-
1300
1277
def test_period_can_hold_element_emptylist (self ):
1301
1278
pi = period_range ("2016" , periods = 3 , freq = "Y" )
1302
1279
blk = new_block (pi ._data .reshape (1 , 3 ), BlockPlacement ([1 ]), ndim = 2 )
@@ -1309,19 +1286,6 @@ def test_period_can_hold_element(self, element):
1309
1286
elem = element (pi )
1310
1287
self .check_series_setitem (elem , pi , True )
1311
1288
1312
- # Careful: to get the expected Series-inplace behavior we need
1313
- # `elem` to not have the same length as `arr`
1314
- pi2 = pi .asfreq ("D" )[:- 1 ]
1315
- elem = element (pi2 )
1316
- msg = "Setting an item of incompatible dtype is deprecated"
1317
- with tm .assert_produces_warning (FutureWarning , match = msg ):
1318
- self .check_series_setitem (elem , pi , False )
1319
-
1320
- dti = pi .to_timestamp ("s" )[:- 1 ]
1321
- elem = element (dti )
1322
- with tm .assert_produces_warning (FutureWarning , match = msg ):
1323
- self .check_series_setitem (elem , pi , False )
1324
-
1325
1289
def check_can_hold_element (self , obj , elem , inplace : bool ):
1326
1290
blk = obj ._mgr .blocks [0 ]
1327
1291
if inplace :
0 commit comments