Skip to content

Commit 8a80e6a

Browse files
committed
Loosen PDF indexing test as different version of MuPDF produces varying results
1 parent 2757511 commit 8a80e6a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/zim/test_indexing.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,10 +296,12 @@ def test_get_pdf_index_data(
296296
filepath=encrypted_pdf_file if pdf_no == 1 else big_pdf_file
297297
)
298298
assert index_data.get_title() == expected_title
299-
assert (
300-
index_data.get_content()
301-
== (encrypted_pdf_content if pdf_no == 1 else big_pdf_content).read_text()
299+
# actual index content is dependent on the MuPDF version used by PyMuPDF
300+
# this checks that index is large-enough
301+
content_size = len(
302+
(encrypted_pdf_content if pdf_no == 1 else big_pdf_content).read_text()
302303
)
304+
assert len(index_data.get_content()) >= content_size * 0.9
303305
assert index_data.has_indexdata()
304306
assert index_data.get_wordcount() == expected_word_count
305307
assert index_data.get_keywords() == ""

0 commit comments

Comments
 (0)