Skip to content

Commit 50f19b6

Browse files
authored
CLN/TST: Remove old filterwarnings (#50368)
1 parent 8469f74 commit 50f19b6

File tree

11 files changed

+4
-43
lines changed

11 files changed

+4
-43
lines changed

pandas/tests/arrays/sparse/test_array.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import re
2-
import warnings
32

43
import numpy as np
54
import pytest
@@ -138,12 +137,9 @@ def test_pickle(self, fix, request):
138137

139138
def test_generator_warnings(self):
140139
sp_arr = SparseArray([1, 2, 3])
141-
with warnings.catch_warnings(record=True) as w:
142-
warnings.filterwarnings(action="always", category=DeprecationWarning)
143-
warnings.filterwarnings(action="always", category=PendingDeprecationWarning)
140+
with tm.assert_produces_warning(None):
144141
for _ in sp_arr:
145142
pass
146-
assert len(w) == 0
147143

148144
def test_where_retain_fill_value(self):
149145
# GH#45691 don't lose fill_value on _where

pandas/tests/computation/test_eval.py

-1
Original file line numberDiff line numberDiff line change
@@ -1362,7 +1362,6 @@ def test_query_inplace(self):
13621362
tm.assert_dict_equal(df, expected)
13631363

13641364
@pytest.mark.parametrize("invalid_target", [1, "cat", [1, 2], np.array([]), (1, 3)])
1365-
@pytest.mark.filterwarnings("ignore::FutureWarning")
13661365
def test_cannot_item_assign(self, invalid_target):
13671366
msg = "Cannot assign expression output to target"
13681367
expression = "a = 1 + 2"

pandas/tests/frame/test_repr_info.py

-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
timedelta,
44
)
55
from io import StringIO
6-
import warnings
76

87
import numpy as np
98
import pytest
@@ -206,9 +205,6 @@ def test_repr_big(self):
206205
def test_repr_unsortable(self, float_frame):
207206
# columns are not sortable
208207

209-
warn_filters = warnings.filters
210-
warnings.filterwarnings("ignore", category=FutureWarning, module=".*format")
211-
212208
unsortable = DataFrame(
213209
{
214210
"foo": [1] * 50,
@@ -231,8 +227,6 @@ def test_repr_unsortable(self, float_frame):
231227

232228
tm.reset_display_options()
233229

234-
warnings.filters = warn_filters
235-
236230
def test_repr_unicode(self):
237231
uval = "\u03c3\u03c3\u03c3\u03c3"
238232

pandas/tests/frame/test_ufunc.py

-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import numpy as np
55
import pytest
66

7-
from pandas.compat.numpy import np_version_gte1p22
87
import pandas.util._test_decorators as td
98

109
import pandas as pd
@@ -264,12 +263,6 @@ def test_alignment_deprecation_many_inputs(request):
264263
vectorize,
265264
)
266265

267-
if np_version_gte1p22:
268-
mark = pytest.mark.filterwarnings(
269-
"ignore:`np.MachAr` is deprecated.*:DeprecationWarning"
270-
)
271-
request.node.add_marker(mark)
272-
273266
@vectorize([float64(float64, float64, float64)])
274267
def my_ufunc(x, y, z):
275268
return x + y + z

pandas/tests/indexes/multi/test_formats.py

-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import warnings
2-
31
import numpy as np
42
import pytest
53

@@ -23,15 +21,11 @@ def test_format_integer_names():
2321

2422

2523
def test_format_sparse_config(idx):
26-
warn_filters = warnings.filters
27-
warnings.filterwarnings("ignore", category=FutureWarning, module=".*format")
2824
# GH1538
2925
with pd.option_context("display.multi_sparse", False):
3026
result = idx.format()
3127
assert result[1] == "foo two"
3228

33-
warnings.filters = warn_filters
34-
3529

3630
def test_format_sparse_display():
3731
index = MultiIndex(

pandas/tests/io/formats/test_format.py

-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ def has_expanded_repr(df):
171171
return False
172172

173173

174-
@pytest.mark.filterwarnings("ignore::FutureWarning:.*format")
175174
class TestDataFrameFormatting:
176175
def test_eng_float_formatter(self, float_frame):
177176
df = float_frame

pandas/tests/io/parser/test_parse_dates.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
timezone,
1111
)
1212
from io import StringIO
13-
import warnings
1413

1514
from dateutil.parser import parse as du_parse
1615
from hypothesis import given
@@ -1751,11 +1750,9 @@ def test_hypothesis_delimited_date(
17511750
)
17521751
date_string = test_datetime.strftime(date_format.replace(" ", delimiter))
17531752

1754-
with warnings.catch_warnings():
1755-
warnings.filterwarnings("ignore", category=UserWarning)
1756-
except_out_dateutil, result = _helper_hypothesis_delimited_date(
1757-
parse_datetime_string, date_string, dayfirst=dayfirst
1758-
)
1753+
except_out_dateutil, result = _helper_hypothesis_delimited_date(
1754+
parse_datetime_string, date_string, dayfirst=dayfirst
1755+
)
17591756
except_in_dateutil, expected = _helper_hypothesis_delimited_date(
17601757
du_parse,
17611758
date_string,

pandas/tests/io/pytables/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
pytest.mark.filterwarnings(
66
"ignore:a closed node found in the registry:UserWarning"
77
),
8-
pytest.mark.filterwarnings(r"ignore:tostring\(\) is deprecated:DeprecationWarning"),
98
pytest.mark.filterwarnings(
109
r"ignore:`np\.object` is a deprecated alias.*:DeprecationWarning"
1110
),

pandas/tests/test_downstream.py

-4
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,6 @@ def test_oo_optimized_datetime_index_unpickle():
158158
# patsy needs to update their imports
159159
"ignore:Using or importing the ABCs from 'collections:DeprecationWarning"
160160
)
161-
@pytest.mark.filterwarnings(
162-
# numpy 1.22
163-
"ignore:`np.MachAr` is deprecated.*:DeprecationWarning"
164-
)
165161
def test_statsmodels():
166162

167163
statsmodels = import_module("statsmodels") # noqa:F841

pandas/tests/window/test_api.py

-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,6 @@ def test_multiple_agg_funcs(func, window_size, expected_vals):
337337
tm.assert_frame_equal(result, expected)
338338

339339

340-
@pytest.mark.filterwarnings("ignore:min_periods:FutureWarning")
341340
def test_dont_modify_attributes_after_methods(
342341
arithmetic_win_operators, closed, center, min_periods, step
343342
):

pyproject.toml

-5
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,6 @@ doctest_optionflags = [
297297
"ELLIPSIS",
298298
]
299299
filterwarnings = [
300-
"error:Sparse:FutureWarning",
301-
"error:The SparseArray:FutureWarning",
302-
# Deprecation gives warning on import during pytest collection
303-
"ignore:pandas.core.index is deprecated:FutureWarning:importlib",
304-
"ignore:pandas.util.testing is deprecated:FutureWarning:importlib",
305300
# Will be fixed in numba 0.56: https://github.com/numba/numba/issues/7758
306301
"ignore:`np.MachAr` is deprecated:DeprecationWarning:numba",
307302
]

0 commit comments

Comments
 (0)