Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7d73d72

Browse files
authored
Merge pull request #19161 from anntzer/pdfio
Simplify test_backend_pdf::test_multipage_properfinalize.
2 parents e164fbb + 427b2f2 commit 7d73d72

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/matplotlib/tests/test_backend_pdf.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import io
44
import os
55
from pathlib import Path
6-
import sys
76
from tempfile import NamedTemporaryFile
87

98
import numpy as np
@@ -66,9 +65,9 @@ def test_multipage_properfinalize():
6665
fig, ax = plt.subplots()
6766
ax.set_title('This is a long title')
6867
fig.savefig(pdf, format="pdf")
69-
pdfio.seek(0)
70-
assert sum(b'startxref' in line for line in pdfio) == 1
71-
assert sys.getsizeof(pdfio) < 40000
68+
s = pdfio.getvalue()
69+
assert s.count(b'startxref') == 1
70+
assert len(s) < 40000
7271

7372

7473
def test_multipage_keep_empty():

0 commit comments

Comments
 (0)