From 9b372c8d385007c18c5d57fb925acb8c1f718bc7 Mon Sep 17 00:00:00 2001 From: Maxim Ivanov Date: Fri, 6 Nov 2020 22:45:03 +0700 Subject: [PATCH 1/2] TST: match matplotlib warning message --- pandas/tests/plotting/test_frame.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/pandas/tests/plotting/test_frame.py b/pandas/tests/plotting/test_frame.py index e6a61d35365a3..7fcf7eb037464 100644 --- a/pandas/tests/plotting/test_frame.py +++ b/pandas/tests/plotting/test_frame.py @@ -2739,11 +2739,8 @@ def test_errorbar_plot_different_kinds(self, kind): ax = _check_plot_works(df.plot, xerr=0.2, yerr=0.2, kind=kind) self._check_has_errorbars(ax, xerr=2, yerr=2) - with tm.assert_produces_warning(UserWarning): - # _check_plot_works creates subplots inside, - # which leads to warnings like this: - # UserWarning: To output multiple subplots, - # the figure containing the passed axes is being cleared + msg = r"To output multiple subplots, the figure .* is being cleared" + with tm.assert_produces_warning(UserWarning, match=msg): # Similar warnings were observed in GH #13188 axes = _check_plot_works( df.plot, yerr=df_err, xerr=df_err, subplots=True, kind=kind @@ -2820,11 +2817,8 @@ def test_errorbar_timeseries(self, kind): ax = _check_plot_works(tdf.plot, yerr=tdf_err, kind=kind) self._check_has_errorbars(ax, xerr=0, yerr=2) - with tm.assert_produces_warning(UserWarning): - # _check_plot_works creates subplots inside, - # which leads to warnings like this: - # UserWarning: To output multiple subplots, - # the figure containing the passed axes is being cleared + msg = r"To output multiple subplots, the figure .* is being cleared" + with tm.assert_produces_warning(UserWarning, match=msg): # Similar warnings were observed in GH #13188 axes = _check_plot_works(tdf.plot, kind=kind, yerr=tdf_err, subplots=True) self._check_has_errorbars(axes, xerr=0, yerr=1) From b7b707cebe5e9d43f2477be77025cec6c2fb81fc Mon Sep 17 00:00:00 2001 From: Maxim Ivanov Date: Sat, 7 Nov 2020 19:27:42 +0700 Subject: [PATCH 2/2] TST: match full message --- pandas/tests/plotting/test_frame.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pandas/tests/plotting/test_frame.py b/pandas/tests/plotting/test_frame.py index 7fcf7eb037464..c9d1d84e0b7cf 100644 --- a/pandas/tests/plotting/test_frame.py +++ b/pandas/tests/plotting/test_frame.py @@ -2739,7 +2739,10 @@ def test_errorbar_plot_different_kinds(self, kind): ax = _check_plot_works(df.plot, xerr=0.2, yerr=0.2, kind=kind) self._check_has_errorbars(ax, xerr=2, yerr=2) - msg = r"To output multiple subplots, the figure .* is being cleared" + msg = ( + "To output multiple subplots, " + "the figure containing the passed axes is being cleared" + ) with tm.assert_produces_warning(UserWarning, match=msg): # Similar warnings were observed in GH #13188 axes = _check_plot_works( @@ -2817,7 +2820,10 @@ def test_errorbar_timeseries(self, kind): ax = _check_plot_works(tdf.plot, yerr=tdf_err, kind=kind) self._check_has_errorbars(ax, xerr=0, yerr=2) - msg = r"To output multiple subplots, the figure .* is being cleared" + msg = ( + "To output multiple subplots, " + "the figure containing the passed axes is being cleared" + ) with tm.assert_produces_warning(UserWarning, match=msg): # Similar warnings were observed in GH #13188 axes = _check_plot_works(tdf.plot, kind=kind, yerr=tdf_err, subplots=True)