From 98dfc0d3d5d2c3b59bd3a3dd06085cdd0a9a79f1 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Sun, 3 Dec 2017 01:20:06 -0800 Subject: [PATCH] Unify (parametrize) test_composite across backends. --- lib/matplotlib/tests/test_backend_ps.py | 24 ------------------------ lib/matplotlib/tests/test_backend_svg.py | 24 ------------------------ lib/matplotlib/tests/test_image.py | 20 ++++++++++++++++++++ 3 files changed, 20 insertions(+), 48 deletions(-) diff --git a/lib/matplotlib/tests/test_backend_ps.py b/lib/matplotlib/tests/test_backend_ps.py index 64fbd5dbe65c..17f58b6ee152 100644 --- a/lib/matplotlib/tests/test_backend_ps.py +++ b/lib/matplotlib/tests/test_backend_ps.py @@ -81,30 +81,6 @@ def test_savefig_to_stringio(format, use_log, rcParams): buffer.close() -def test_composite_image(): - # Test that figures can be saved with and without combining multiple images - # (on a single set of axes) into a single composite image. - X, Y = np.meshgrid(np.arange(-5, 5, 1), np.arange(-5, 5, 1)) - Z = np.sin(Y ** 2) - fig = plt.figure() - ax = fig.add_subplot(1, 1, 1) - ax.set_xlim(0, 3) - ax.imshow(Z, extent=[0, 1, 0, 1]) - ax.imshow(Z[::-1], extent=[2, 3, 0, 1]) - plt.rcParams['image.composite_image'] = True - with io.BytesIO() as ps: - fig.savefig(ps, format="ps") - ps.seek(0) - buff = ps.read() - assert buff.count(six.b(' colorimage')) == 1 - plt.rcParams['image.composite_image'] = False - with io.BytesIO() as ps: - fig.savefig(ps, format="ps") - ps.seek(0) - buff = ps.read() - assert buff.count(six.b(' colorimage')) == 2 - - def test_patheffects(): with matplotlib.rc_context(): matplotlib.rcParams['path.effects'] = [ diff --git a/lib/matplotlib/tests/test_backend_svg.py b/lib/matplotlib/tests/test_backend_svg.py index cb031abd5ab8..055c220982a6 100644 --- a/lib/matplotlib/tests/test_backend_svg.py +++ b/lib/matplotlib/tests/test_backend_svg.py @@ -63,30 +63,6 @@ def test_noscale(): ax.imshow(Z, cmap='gray', interpolation='none') -def test_composite_images(): - #Test that figures can be saved with and without combining multiple images - #(on a single set of axes) into a single composite image. - X, Y = np.meshgrid(np.arange(-5, 5, 1), np.arange(-5, 5, 1)) - Z = np.sin(Y ** 2) - fig = plt.figure() - ax = fig.add_subplot(1, 1, 1) - ax.set_xlim(0, 3) - ax.imshow(Z, extent=[0, 1, 0, 1]) - ax.imshow(Z[::-1], extent=[2, 3, 0, 1]) - plt.rcParams['image.composite_image'] = True - with BytesIO() as svg: - fig.savefig(svg, format="svg") - svg.seek(0) - buff = svg.read() - assert buff.count(six.b('