From 11a98acb8e91a12bd93a7e506ef544040ff789cc Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 25 Sep 2018 17:07:59 -0400 Subject: [PATCH] Backport PR #12262: Simplify empty-rasterized pdf test. --- lib/matplotlib/tests/test_backend_pdf.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/matplotlib/tests/test_backend_pdf.py b/lib/matplotlib/tests/test_backend_pdf.py index 773c6021be3d..a0bfe6213e73 100644 --- a/lib/matplotlib/tests/test_backend_pdf.py +++ b/lib/matplotlib/tests/test_backend_pdf.py @@ -234,9 +234,8 @@ def test_failing_latex(tmpdir): plt.savefig(path) -def test_empty_rasterised(): +def test_empty_rasterized(): # Check that emtpy figures that are rasterised save to pdf files fine - with PdfPages(io.BytesIO()) as pdf: - fig, ax = plt.subplots() - ax.plot([], [], rasterized=True) - fig.savefig(pdf, format="pdf") + fig, ax = plt.subplots() + ax.plot([], [], rasterized=True) + fig.savefig(io.BytesIO(), format="pdf")