forked from pymupdf/PyMuPDF
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests/: added test_2907() for segfault bug in classic.
This is for pymupdf#2907, 'segfault trying to call clean_contents on certain pdfs with python 3.12'. We are not intending to fix this bug, so actually this test only runs on rebased.
- Loading branch information
1 parent
f2f8ad0
commit 4b4840d
Showing
2 changed files
with
18 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import fitz | ||
|
||
import os.path | ||
import pathlib | ||
|
||
def test_2907(): | ||
# This test is for a bug in classic 'segfault trying to call clean_contents | ||
# on certain pdfs with python 3.12', which we are not going to fix. | ||
if not hasattr(fitz, 'mupdf'): | ||
print('test_2907(): not running on classic because known to fail.') | ||
return | ||
path = os.path.abspath(f'{__file__}/../../tests/resources/test_2907.pdf') | ||
pdf_file = pathlib.Path(path).read_bytes() | ||
fitz_document = fitz.open(stream=pdf_file, filetype="application/pdf") | ||
|
||
pdf_pages = list(fitz_document.pages()) | ||
(page,) = pdf_pages | ||
page.clean_contents() |