Skip to content

COMPAT: numpy test warnings #30345

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 13 commits into from
Jan 21, 2020
Merged
2 changes: 2 additions & 0 deletions pandas/tests/arrays/test_integer.py
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,8 @@ def test_astype_nansafe():


@pytest.mark.parametrize("ufunc", [np.abs, np.sign])
# np.sign emits a warning with nans, <https://github.com/numpy/numpy/issues/15127>
@pytest.mark.filterwarnings("ignore:invalid value encountered in sign")
def test_ufuncs_single_int(ufunc):
a = integer_array([1, 2, -3, np.nan])
result = ufunc(a)
Expand Down
14 changes: 12 additions & 2 deletions pandas/tests/plotting/test_datetimelike.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
""" Test cases for time series specific (freq conversion, etc) """
from datetime import date, datetime, time, timedelta
from datetime import date, datetime, time, timedelta, timezone
import pickle
import sys

import dateutil
import numpy as np
import pytest
import pytz

import pandas.util._test_decorators as td

Expand Down Expand Up @@ -49,7 +51,15 @@ def test_ts_plot_with_tz(self, tz_aware_fixture):
tz = tz_aware_fixture
index = date_range("1/1/2011", periods=2, freq="H", tz=tz)
ts = Series([188.5, 328.25], index=index)
_check_plot_works(ts.plot)
if tz in ["UTC", pytz.UTC, timezone.utc] or isinstance(
tz, dateutil.tz.tz.tzutc
):
# Converting to PeriodArray/Index representation will drop timezone
# information.
with tm.assert_produces_warning(UserWarning):
_check_plot_works(ts.plot)
else:
_check_plot_works(ts.plot)

def test_fontsize_set_correctly(self):
# For issue #8765
Expand Down
7 changes: 6 additions & 1 deletion pandas/tests/plotting/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,12 @@ def test_subplots_timeseries_y_axis(self):
ax_datetime_no_tz.get_lines()[0].get_data()[1]
== testdata["datetime_no_tz"].values
).all()
ax_datetime_all_tz = testdata.plot(y="datetime_all_tz")
# FutureWarning: Converting timezone-aware DatetimeArray to timezone-naive
# ndarray with 'datetime64[ns]' dtype. In the future, this will return an
# ndarray with 'object' dtype where each element is a 'pandas.Timestamp' with
# the correct 'tz'.
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
ax_datetime_all_tz = testdata.plot(y="datetime_all_tz")
assert (
ax_datetime_all_tz.get_lines()[0].get_data()[1]
== testdata["datetime_all_tz"].values
Expand Down