Skip to content

Commit 7a82ee3

Browse files
committed
TST: remove warnings on test_strings.py
1 parent b583f00 commit 7a82ee3

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

pandas/tests/test_strings.py

+13-7
Original file line numberDiff line numberDiff line change
@@ -1329,33 +1329,37 @@ def test_split_no_pat_with_nonzero_n(self):
13291329
def test_split_to_dataframe(self):
13301330
s = Series(['nosplit', 'alsonosplit'])
13311331

1332-
with tm.assert_produces_warning():
1332+
with tm.assert_produces_warning(FutureWarning):
13331333
result = s.str.split('_', return_type='frame')
13341334

13351335
exp = DataFrame({0: Series(['nosplit', 'alsonosplit'])})
13361336
tm.assert_frame_equal(result, exp)
13371337

13381338
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')
13401341
exp = DataFrame({0: ['some', 'with'], 1: ['equal', 'no'],
13411342
2: ['splits', 'nans']})
13421343
tm.assert_frame_equal(result, exp)
13431344

13441345
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')
13461348
exp = DataFrame({0: ['some', 'one'], 1: ['unequal', 'of'],
13471349
2: ['splits', 'these'], 3: [NA, 'things'],
13481350
4: [NA, 'is'], 5: [NA, 'not']})
13491351
tm.assert_frame_equal(result, exp)
13501352

13511353
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')
13531356
exp = DataFrame({0: ['some', 'with'], 1: ['splits', 'index']},
13541357
index=['preserve', 'me'])
13551358
tm.assert_frame_equal(result, exp)
13561359

13571360
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")
13591363

13601364
def test_split_to_dataframe_expand(self):
13611365
s = Series(['nosplit', 'alsonosplit'])
@@ -1383,7 +1387,8 @@ def test_split_to_dataframe_expand(self):
13831387
tm.assert_frame_equal(result, exp)
13841388

13851389
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")
13871392

13881393
def test_split_to_multiindex_expand(self):
13891394
idx = Index(['nosplit', 'alsonosplit'])
@@ -1407,7 +1412,8 @@ def test_split_to_multiindex_expand(self):
14071412
self.assertEqual(result.nlevels, 6)
14081413

14091414
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")
14111417

14121418
def test_rsplit_to_dataframe_expand(self):
14131419
s = Series(['nosplit', 'alsonosplit'])

0 commit comments

Comments
 (0)