Skip to content

Commit d5f10fa

Browse files
author
y-p
committed
TST: clear more FutureWarnings from test suite
1 parent f33641a commit d5f10fa

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

pandas/tests/test_format.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import sys
1010
import unittest
1111
from textwrap import dedent
12+
import warnings
1213

1314
from numpy import nan
1415
from numpy.random import randn
@@ -30,12 +31,16 @@ def curpath():
3031
class TestDataFrameFormatting(unittest.TestCase):
3132
_multiprocess_can_split_ = True
3233
def setUp(self):
33-
import warnings
34-
self.frame = _frame.copy()
34+
self.warn_filters = warnings.filters
3535
warnings.filterwarnings('ignore',
3636
category=FutureWarning,
3737
module=".*format")
3838

39+
self.frame = _frame.copy()
40+
41+
def tearDown(self):
42+
warnings.filters = self.warn_filters
43+
3944
def test_repr_embedded_ndarray(self):
4045
arr = np.empty(10, dtype=[('err', object)])
4146
for i in range(len(arr)):

pandas/tests/test_frame.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2934,6 +2934,11 @@ def test_repr_big(self):
29342934

29352935
def test_repr_unsortable(self):
29362936
# columns are not sortable
2937+
import warnings
2938+
warn_filters = warnings.filters
2939+
warnings.filterwarnings('ignore',
2940+
category=FutureWarning,
2941+
module=".*format")
29372942

29382943
unsortable = DataFrame({'foo' : [1] * 50,
29392944
datetime.today() : [1] * 50,
@@ -2953,6 +2958,8 @@ def test_repr_unsortable(self):
29532958

29542959
fmt.reset_printoptions()
29552960

2961+
warnings.filters = warn_filters
2962+
29562963
def test_repr_unicode(self):
29572964
uval = u'\u03c3\u03c3\u03c3\u03c3'
29582965
bval = uval.encode('utf-8')

pandas/tests/test_index.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,6 +1319,11 @@ def test_format_sparse_display(self):
13191319
self.assertEqual(result[3], '1 0 0 0')
13201320

13211321
def test_format_sparse_config(self):
1322+
import warnings
1323+
warn_filters = warnings.filters
1324+
warnings.filterwarnings('ignore',
1325+
category=FutureWarning,
1326+
module=".*format")
13221327
# #1538
13231328
pd.set_printoptions(multi_sparse=False)
13241329

@@ -1327,6 +1332,8 @@ def test_format_sparse_config(self):
13271332

13281333
pd.reset_printoptions()
13291334

1335+
warnings.filters = warn_filters
1336+
13301337
def test_bounds(self):
13311338
self.index._bounds
13321339

0 commit comments

Comments
 (0)