From 5cb86a830523a5f7d6183003fdc574563ca3ab55 Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Thu, 11 Jun 2020 15:17:25 -0700 Subject: [PATCH 1/4] Removed fixme --- pandas/tests/extension/base/dtype.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pandas/tests/extension/base/dtype.py b/pandas/tests/extension/base/dtype.py index 65e32d716a4db..1ed1310fe70f7 100644 --- a/pandas/tests/extension/base/dtype.py +++ b/pandas/tests/extension/base/dtype.py @@ -75,11 +75,7 @@ def test_check_dtype(self, data): else: expected = pd.Series([True, True, False, False], index=list("ABCD")) - # FIXME: This should probably be *fixed* not ignored. - # See libops.scalar_compare - with warnings.catch_warnings(): - warnings.simplefilter("ignore", DeprecationWarning) - result = df.dtypes == str(dtype) + result = df.dtypes == str(dtype) self.assert_series_equal(result, expected) From fe5a29e0e874567107d52e78fa1e18cf1d110393 Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Fri, 12 Jun 2020 07:05:26 -0500 Subject: [PATCH 2/4] Fixup --- pandas/compat/numpy/__init__.py | 2 ++ pandas/tests/extension/base/dtype.py | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pandas/compat/numpy/__init__.py b/pandas/compat/numpy/__init__.py index a8f49d91f040e..789a4668b6fee 100644 --- a/pandas/compat/numpy/__init__.py +++ b/pandas/compat/numpy/__init__.py @@ -11,6 +11,8 @@ _np_version_under1p16 = _nlv < LooseVersion("1.16") _np_version_under1p17 = _nlv < LooseVersion("1.17") _np_version_under1p18 = _nlv < LooseVersion("1.18") +_np_version_under1p19 = _nlv < LooseVersion("1.19") +_np_version_under1p20 = _nlv < LooseVersion("1.20") _is_numpy_dev = ".dev" in str(_nlv) diff --git a/pandas/tests/extension/base/dtype.py b/pandas/tests/extension/base/dtype.py index 1ed1310fe70f7..7fdca64137b43 100644 --- a/pandas/tests/extension/base/dtype.py +++ b/pandas/tests/extension/base/dtype.py @@ -3,6 +3,8 @@ import numpy as np import pytest +from pandas.compat.numpy import _np_version_under1p20 + import pandas as pd from .base import BaseExtensionTests @@ -70,12 +72,16 @@ def test_check_dtype(self, data): # np.dtype('int64') == 'Int64' == 'int64' # so can't distinguish - if dtype.name == "Int64": + if dtype.name == "Int64" and _np_version_under1p20: + # TODO(numpy-1.20): This if block and the warnings filter can be removed + # once we require numpy>=1.20 expected = pd.Series([True, True, False, True], index=list("ABCD")) else: expected = pd.Series([True, True, False, False], index=list("ABCD")) - result = df.dtypes == str(dtype) + with warnings.catch_warnings(): + warnings.simplefilter("ignore", DeprecationWarning) + result = df.dtypes == str(dtype) self.assert_series_equal(result, expected) From e1fd6099d0988a39bbde48da7d36cca2f42d9e06 Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Fri, 12 Jun 2020 13:38:16 -0500 Subject: [PATCH 3/4] fixup --- pandas/tests/extension/base/dtype.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/pandas/tests/extension/base/dtype.py b/pandas/tests/extension/base/dtype.py index 7fdca64137b43..154fcdc38826d 100644 --- a/pandas/tests/extension/base/dtype.py +++ b/pandas/tests/extension/base/dtype.py @@ -3,8 +3,6 @@ import numpy as np import pytest -from pandas.compat.numpy import _np_version_under1p20 - import pandas as pd from .base import BaseExtensionTests @@ -70,18 +68,22 @@ def test_check_dtype(self, data): {"A": pd.Series(data, dtype=dtype), "B": data, "C": "foo", "D": 1} ) - # np.dtype('int64') == 'Int64' == 'int64' - # so can't distinguish - if dtype.name == "Int64" and _np_version_under1p20: - # TODO(numpy-1.20): This if block and the warnings filter can be removed - # once we require numpy>=1.20 - expected = pd.Series([True, True, False, True], index=list("ABCD")) - else: - expected = pd.Series([True, True, False, False], index=list("ABCD")) - + # TODO(numpy-1.20): This warnings filter and if block can be removed + # once we require numpy>=1.20 with warnings.catch_warnings(): warnings.simplefilter("ignore", DeprecationWarning) result = df.dtypes == str(dtype) + # NumPy>=1.20.0, but not pandas.compat.numpy till there + # is a wheel available with this change. + try: + new_numpy_behavior = np.dtype("int64") != "Int64" + except TypeError: + new_numpy_behavior = True + + if dtype.name == "Int64" and not new_numpy_behavior: + expected = pd.Series([True, True, False, True], index=list("ABCD")) + else: + expected = pd.Series([True, True, False, False], index=list("ABCD")) self.assert_series_equal(result, expected) From 43cc13d8bd3a3bfb0bf70cdb552dd8e332996c69 Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Fri, 12 Jun 2020 15:13:41 -0500 Subject: [PATCH 4/4] ignore for mpl --- pandas/tests/plotting/test_misc.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pandas/tests/plotting/test_misc.py b/pandas/tests/plotting/test_misc.py index 27039948dfc16..0b0d23632e827 100644 --- a/pandas/tests/plotting/test_misc.py +++ b/pandas/tests/plotting/test_misc.py @@ -96,13 +96,17 @@ def test_bootstrap_plot(self): class TestDataFramePlots(TestPlotBase): @td.skip_if_no_scipy def test_scatter_matrix_axis(self): + from pandas.plotting._matplotlib.compat import _mpl_ge_3_0_0 + scatter_matrix = plotting.scatter_matrix with tm.RNGContext(42): df = DataFrame(randn(100, 3)) # we are plotting multiples on a sub-plot - with tm.assert_produces_warning(UserWarning): + with tm.assert_produces_warning( + UserWarning, raise_on_extra_warnings=_mpl_ge_3_0_0() + ): axes = _check_plot_works( scatter_matrix, filterwarnings="always", frame=df, range_padding=0.1 )