Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 621393b

Browse filesBrowse files
committed
TST: Check just one startxref and file size not ballooning
1 parent 5f654dc commit 621393b
Copy full SHA for 621393b

File tree

Expand file treeCollapse file tree

1 file changed

+14
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+14
-0
lines changed

‎lib/matplotlib/tests/test_backend_pdf.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_backend_pdf.py
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import io
99
import os
10+
import sys
1011
import tempfile
1112

1213
import pytest
@@ -71,6 +72,19 @@ def test_multipage_pagecount():
7172
assert pdf.get_pagecount() == 2
7273

7374

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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.