Skip to content

Commit

Permalink
tests/: added test for getting text from .epub.
Browse files Browse the repository at this point in the history
Verifies #3687 is ok.
  • Loading branch information
julian-smith-artifex-com committed Jul 17, 2024
1 parent 2414c80 commit 1509a07
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Binary file added tests/resources/test_3687-3.epub
Binary file not shown.
Binary file added tests/resources/test_3687.epub
Binary file not shown.
14 changes: 14 additions & 0 deletions tests/test_textextract.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,3 +329,17 @@ def test_3594():
# We expect MuPDF warnings.
wt = pymupdf.TOOLS.mupdf_warnings()
assert wt


def test_3687():
path1 = pymupdf.open(os.path.normpath(f'{__file__}/../../tests/resources/test_3687.epub'))
path2 = pymupdf.open(os.path.normpath(f'{__file__}/../../tests/resources/test_3687-3.epub'))
for path in path1, path2:
print(f'Looking at {path=}.')
with pymupdf.open(path) as document:
page = document[0]
text = page.get_text("text")
print(f'{text=!s}')
wt = pymupdf.TOOLS.mupdf_warnings()
print(f'{wt=}')
assert wt == 'unknown epub version: 3.0'

0 comments on commit 1509a07

Please sign in to comment.