Skip to content

CLN: remove warnings clearing #30608

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions pandas/tests/arithmetic/test_datetime64.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
Timestamp,
date_range,
)
import pandas.core.arrays.datetimelike as dtl
from pandas.core.indexes.datetimes import _to_M8
from pandas.core.ops import roperator
from pandas.tests.arithmetic.common import (
Expand Down Expand Up @@ -1332,7 +1331,7 @@ def test_dt64arr_add_mixed_offset_array(self, box_with_array):
s = tm.box_expected(s, box_with_array)

warn = None if box_with_array is pd.DataFrame else PerformanceWarning
with tm.assert_produces_warning(warn, clear=[dtl]):
with tm.assert_produces_warning(warn):
other = pd.Index([pd.offsets.DateOffset(years=1), pd.offsets.MonthEnd()])
other = tm.box_expected(other, box_with_array)
result = s + other
Expand Down Expand Up @@ -1361,19 +1360,19 @@ def test_dt64arr_add_sub_offset_ndarray(self, tz_naive_fixture, box_with_array):
other = np.array([pd.offsets.MonthEnd(), pd.offsets.Day(n=2)])

warn = None if box_with_array is pd.DataFrame else PerformanceWarning
with tm.assert_produces_warning(warn, clear=[dtl]):
with tm.assert_produces_warning(warn):
res = dtarr + other
expected = DatetimeIndex(
[dti[n] + other[n] for n in range(len(dti))], name=dti.name, freq="infer"
)
expected = tm.box_expected(expected, box_with_array)
tm.assert_equal(res, expected)

with tm.assert_produces_warning(warn, clear=[dtl]):
with tm.assert_produces_warning(warn):
res2 = other + dtarr
tm.assert_equal(res2, expected)

with tm.assert_produces_warning(warn, clear=[dtl]):
with tm.assert_produces_warning(warn):
res = dtarr - other
expected = DatetimeIndex(
[dti[n] - other[n] for n in range(len(dti))], name=dti.name, freq="infer"
Expand Down Expand Up @@ -2298,7 +2297,7 @@ def test_dti_addsub_offset_arraylike(

xbox = get_upcast_box(box, other)

with tm.assert_produces_warning(PerformanceWarning, clear=[dtl]):
with tm.assert_produces_warning(PerformanceWarning):
res = op(dti, other)

expected = DatetimeIndex(
Expand Down