Skip to content

Commit 26395b9

Browse files
committed
TST: show deprecation config options as FutureWarnings
1 parent 2dac793 commit 26395b9

File tree

5 files changed

+7
-8
lines changed

5 files changed

+7
-8
lines changed

doc/source/whatsnew/v0.23.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ Other API Changes
207207
- :func:`wide_to_long` previously kept numeric-like suffixes as ``object`` dtype. Now they are cast to numeric if possible (:issue:`17627`)
208208
- In :func:`read_excel`, the ``comment`` argument is now exposed as a named parameter (:issue:`18735`)
209209
- Rearranged the order of keyword arguments in :func:`read_excel()` to align with :func:`read_csv()` (:issue:`16672`)
210+
- The options ``html.border`` and ``mode.use_inf_as_null`` were deprecated in prior versions, these will now show ``FutureWarning`` rather than a ``DeprecationWarning`` (:issue:`19003`)
210211

211212
.. _whatsnew_0230.deprecations:
212213

pandas/core/config.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ def _warn_if_deprecated(key):
613613
if d:
614614
if d.msg:
615615
print(d.msg)
616-
warnings.warn(d.msg, DeprecationWarning)
616+
warnings.warn(d.msg, FutureWarning)
617617
else:
618618
msg = "'{key}' is deprecated".format(key=key)
619619
if d.removal_ver:
@@ -624,7 +624,7 @@ def _warn_if_deprecated(key):
624624
else:
625625
msg += ', please refrain from using it.'
626626

627-
warnings.warn(msg, DeprecationWarning)
627+
warnings.warn(msg, FutureWarning)
628628
return True
629629
return False
630630

pandas/tests/groupby/test_nth.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def test_nth(self):
175175
df = DataFrame([[1, np.nan], [1, 4], [5, 6]], columns=['A', 'B'])
176176
g = df.groupby('A')
177177
# PR 17493, related to issue 11038
178-
# test Series.nth with True for dropna produces DeprecationWarning
178+
# test Series.nth with True for dropna produces FutureWarning
179179
with assert_produces_warning(FutureWarning):
180180
result = g.B.nth(0, dropna=True)
181181
expected = g.B.first()

pandas/tests/io/formats/test_to_html.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1411,8 +1411,9 @@ def test_to_html_border_zero(self):
14111411
result = df.to_html(border=0)
14121412
assert 'border="0"' in result
14131413

1414+
@tm.capture_stdout
14141415
def test_display_option_warning(self):
1415-
with tm.assert_produces_warning(DeprecationWarning,
1416+
with tm.assert_produces_warning(FutureWarning,
14161417
check_stacklevel=False):
14171418
pd.options.html.border
14181419

pandas/tests/series/test_missing.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -480,12 +480,9 @@ def test_isna_for_inf(self):
480480
def test_isnull_for_inf_deprecated(self):
481481
# gh-17115
482482
s = Series(['a', np.inf, np.nan, 1.0])
483-
with tm.assert_produces_warning(DeprecationWarning,
484-
check_stacklevel=False):
485-
pd.set_option('mode.use_inf_as_null', True)
483+
with pd.option_context('mode.use_inf_as_null', True):
486484
r = s.isna()
487485
dr = s.dropna()
488-
pd.reset_option('mode.use_inf_as_null')
489486

490487
e = Series([False, True, True, False])
491488
de = Series(['a', 1.0], index=[0, 3])

0 commit comments

Comments
 (0)