We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f0a614e + ed9aec3 commit c033e10Copy full SHA for c033e10
tests/test_insertpdf.py
@@ -3,6 +3,7 @@
3
* Compare with stored earlier result:
4
- must have identical object definitions
5
- must have different trailers
6
+* Try inserting files in a loop.
7
"""
8
import os
9
@@ -35,3 +36,13 @@ def test_joining():
35
36
)
37
assert old_output.xref_get_keys(-1) == new_output.xref_get_keys(-1)
38
assert old_output.xref_get_key(-1, "ID") != new_output.xref_get_key(-1, "ID")
39
+
40
41
+def test_issue1417_insertpdf_in_loop():
42
+ """Using a context manager instead of explicitly closing files"""
43
+ f = os.path.join(resources, "1.pdf")
44
+ big_doc = fitz.open()
45
+ for n in range(0, 1025):
46
+ with fitz.open(f) as pdf:
47
+ big_doc.insert_pdf(pdf)
48
+ big_doc.close()
0 commit comments