8000 TST: Check just one startxref and file size not ballooning · matplotlib/matplotlib@02cf299 · GitHub
[go: up one dir, main page]

Skip to content

Commit 02cf299

Browse files
committed
TST: Check just one startxref and file size not ballooning
1 parent 5f654dc commit 02cf299

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/matplotlib/tests/test_backend_pdf.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,19 @@ def test_multipage_pagecount():
7171
assert pdf.get_pagecount() == 2
7272

7373

74+
def test_multipage_properfinalize():
75+
pdfio = io.BytesIO()
76+
with PdfPages(pdfio) as pdf:
77+
for i in range(10):
78+
fig = plt.figure()
79+
ax = fig.add_subplot(111)
80+
ax.set_title('This is a long title')
81+
fig.savefig(pdf, format="pdf")
82+
pdfio.seek(0)
83+
assert sum(b'startxref' in line for line in pdfio) == 1
84+
assert pdfio.getbuffer().nbytes < 25000
85+
86+
7487
def test_multipage_keep_empty():
7588
from matplotlib.backends.backend_pdf import PdfPages
7689
from tempfile import NamedTemporaryFile

0 commit comments

Comments
 (0)
0