From 4ac18b185f6cb86998af4c4f33e8a27792cc06eb Mon Sep 17 00:00:00 2001 From: Giovanni Date: Sun, 22 Mar 2015 22:47:05 -0400 Subject: [PATCH 1/4] Fix for unpickling polar plot issue #4068 --- lib/matplotlib/projections/polar.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/matplotlib/projections/polar.py b/lib/matplotlib/projections/polar.py index c78faf7f728a..0a4a7cbca03f 100644 --- a/lib/matplotlib/projections/polar.py +++ b/lib/matplotlib/projections/polar.py @@ -112,10 +112,6 @@ def get_matrix(self): return self._mtx get_matrix.__doc__ = Affine2DBase.get_matrix.__doc__ - def __getstate__(self): - return {} - - class InvertedPolarTransform(Transform): """ The inverse of the polar transform, mapping Cartesian From 689b6ff1a351bde87fb60bc6c9269aa4efbec0c9 Mon Sep 17 00:00:00 2001 From: David Kua Date: Tue, 24 Mar 2015 18:43:32 +0000 Subject: [PATCH 2/4] Fixed spacing issue for pep8 --- lib/matplotlib/projections/polar.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/matplotlib/projections/polar.py b/lib/matplotlib/projections/polar.py index 0a4a7cbca03f..83664fe9e0dc 100644 --- a/lib/matplotlib/projections/polar.py +++ b/lib/matplotlib/projections/polar.py @@ -112,6 +112,7 @@ def get_matrix(self): return self._mtx get_matrix.__doc__ = Affine2DBase.get_matrix.__doc__ + class InvertedPolarTransform(Transform): """ The inverse of the polar transform, mapping Cartesian From d595fe391a27cd925def4c8f608316caeb2b5de9 Mon Sep 17 00:00:00 2001 From: David Kua Date: Tue, 24 Mar 2015 18:47:10 +0000 Subject: [PATCH 3/4] Added @cleanup to all pickle tests as requested --- lib/matplotlib/tests/test_pickle.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/matplotlib/tests/test_pickle.py b/lib/matplotlib/tests/test_pickle.py index f41c2fad16b5..961243eada6e 100644 --- a/lib/matplotlib/tests/test_pickle.py +++ b/lib/matplotlib/tests/test_pickle.py @@ -126,6 +126,7 @@ def test_simple(): pickle.dump(fig, BytesIO(), pickle.HIGHEST_PROTOCOL) +@cleanup @image_comparison(baseline_images=['multi_pickle'], extensions=['png'], remove_text=True) def test_complete(): @@ -194,6 +195,7 @@ def test_complete(): assert_equal(fig.get_label(), 'Figure with a label?') +@cleanup def test_no_pyplot(): # tests pickle-ability of a figure not created with pyplot from matplotlib.backends.backend_pdf import FigureCanvasPdf as fc @@ -206,12 +208,14 @@ def test_no_pyplot(): pickle.dump(fig, BytesIO(), pickle.HIGHEST_PROTOCOL) +@cleanup def test_renderer(): from matplotlib.backends.backend_agg import RendererAgg renderer = RendererAgg(10, 20, 30) pickle.dump(renderer, BytesIO()) +@cleanup def test_image(): # Prior to v1.4.0 the Image would cache data which was not picklable # once it had been drawn. @@ -224,6 +228,7 @@ def test_image(): pickle.dump(fig, BytesIO()) +@cleanup def test_grid(): from matplotlib.backends.backend_agg import new_figure_manager manager = new_figure_manager(1000) From e807fd70192405d21df8da0f1d58aa50c700851e Mon Sep 17 00:00:00 2001 From: David Kua Date: Tue, 24 Mar 2015 21:44:47 +0000 Subject: [PATCH 4/4] Added min test to simulate issue #4068. --- lib/matplotlib/tests/test_pickle.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/matplotlib/tests/test_pickle.py b/lib/matplotlib/tests/test_pickle.py index 961243eada6e..61dd963c4eda 100644 --- a/lib/matplotlib/tests/test_pickle.py +++ b/lib/matplotlib/tests/test_pickle.py @@ -242,6 +242,16 @@ def test_grid(): pickle.dump(ax, BytesIO()) +@cleanup +def test_polar(): + ax = plt.subplot(111, polar=True) + fig = plt.gcf() + result = BytesIO() + pf = pickle.dumps(fig) + pickle.loads(pf) + plt.draw() + + if __name__ == '__main__': import nose nose.runmodule(argv=['-s'])