@@ -1329,33 +1329,37 @@ def test_split_no_pat_with_nonzero_n(self):
1329
1329
def test_split_to_dataframe (self ):
1330
1330
s = Series (['nosplit' , 'alsonosplit' ])
1331
1331
1332
- with tm .assert_produces_warning ():
1332
+ with tm .assert_produces_warning (FutureWarning ):
1333
1333
result = s .str .split ('_' , return_type = 'frame' )
1334
1334
1335
1335
exp = DataFrame ({0 : Series (['nosplit' , 'alsonosplit' ])})
1336
1336
tm .assert_frame_equal (result , exp )
1337
1337
1338
1338
s = Series (['some_equal_splits' , 'with_no_nans' ])
1339
- result = s .str .split ('_' , return_type = 'frame' )
1339
+ with tm .assert_produces_warning (FutureWarning ):
1340
+ result = s .str .split ('_' , return_type = 'frame' )
1340
1341
exp = DataFrame ({0 : ['some' , 'with' ], 1 : ['equal' , 'no' ],
1341
1342
2 : ['splits' , 'nans' ]})
1342
1343
tm .assert_frame_equal (result , exp )
1343
1344
1344
1345
s = Series (['some_unequal_splits' , 'one_of_these_things_is_not' ])
1345
- result = s .str .split ('_' , return_type = 'frame' )
1346
+ with tm .assert_produces_warning (FutureWarning ):
1347
+ result = s .str .split ('_' , return_type = 'frame' )
1346
1348
exp = DataFrame ({0 : ['some' , 'one' ], 1 : ['unequal' , 'of' ],
1347
1349
2 : ['splits' , 'these' ], 3 : [NA , 'things' ],
1348
1350
4 : [NA , 'is' ], 5 : [NA , 'not' ]})
1349
1351
tm .assert_frame_equal (result , exp )
1350
1352
1351
1353
s = Series (['some_splits' , 'with_index' ], index = ['preserve' , 'me' ])
1352
- result = s .str .split ('_' , return_type = 'frame' )
1354
+ with tm .assert_produces_warning (FutureWarning ):
1355
+ result = s .str .split ('_' , return_type = 'frame' )
1353
1356
exp = DataFrame ({0 : ['some' , 'with' ], 1 : ['splits' , 'index' ]},
1354
1357
index = ['preserve' , 'me' ])
1355
1358
tm .assert_frame_equal (result , exp )
1356
1359
1357
1360
with tm .assertRaisesRegexp (ValueError , "expand must be" ):
1358
- s .str .split ('_' , return_type = "some_invalid_type" )
1361
+ with tm .assert_produces_warning (FutureWarning ):
1362
+ s .str .split ('_' , return_type = "some_invalid_type" )
1359
1363
1360
1364
def test_split_to_dataframe_expand (self ):
1361
1365
s = Series (['nosplit' , 'alsonosplit' ])
@@ -1383,7 +1387,8 @@ def test_split_to_dataframe_expand(self):
1383
1387
tm .assert_frame_equal (result , exp )
1384
1388
1385
1389
with tm .assertRaisesRegexp (ValueError , "expand must be" ):
1386
- s .str .split ('_' , return_type = "some_invalid_type" )
1390
+ with tm .assert_produces_warning (FutureWarning ):
1391
+ s .str .split ('_' , return_type = "some_invalid_type" )
1387
1392
1388
1393
def test_split_to_multiindex_expand (self ):
1389
1394
idx = Index (['nosplit' , 'alsonosplit' ])
@@ -1407,7 +1412,8 @@ def test_split_to_multiindex_expand(self):
1407
1412
self .assertEqual (result .nlevels , 6 )
1408
1413
1409
1414
with tm .assertRaisesRegexp (ValueError , "expand must be" ):
1410
- idx .str .split ('_' , return_type = "some_invalid_type" )
1415
+ with tm .assert_produces_warning (FutureWarning ):
1416
+ idx .str .split ('_' , return_type = "some_invalid_type" )
1411
1417
1412
1418
def test_rsplit_to_dataframe_expand (self ):
1413
1419
s = Series (['nosplit' , 'alsonosplit' ])
0 commit comments