Skip to content

Commit 79b6248

Browse files
tests/test_2548.py:test_2548(): fixed for mupdf-1.23.x and mupdf-master.
1 parent 8922a21 commit 79b6248

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

tests/test_2548.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ def test_2548():
99
1010
Old MuPDF version did not detect the loop.
1111
"""
12+
print(f'test_2548(): {fitz.mupdf_version_tuple=}')
1213
if fitz.mupdf_version_tuple < (1, 23, 4):
13-
print(f'Not testing #2548 because infinite hang before mupdf-1.23.4.')
14+
print(f'test_2548(): Not testing #2548 because infinite hang before mupdf-1.23.4.')
1415
return
1516
fitz.TOOLS.mupdf_warnings(reset=True)
1617
doc = fitz.open(f'{root}/tests/resources/test_2548.pdf')
@@ -28,9 +29,13 @@ def test_2548():
2829
expected = "RuntimeError('cycle in structure tree')"
2930
assert repr(ee) == expected, f'Expected {expected=} but got {repr(ee)=}.'
3031
e = True
31-
# After 2023-11-05 mupdf master no longer raises an exception, but does
32-
# write a warning.
3332
wt = fitz.TOOLS.mupdf_warnings()
34-
print(f'{wt=}')
35-
assert wt == 'structure tree broken, assume tree is missing: cycle in structure tree'
36-
assert not e
33+
print(f'test_2548(): {wt=}')
34+
if fitz.mupdf_version_tuple == (1, 23, 5):
35+
assert e
36+
assert not wt
37+
else:
38+
# After 2023-11-05 mupdf master no longer raises an exception, but does
39+
# write a warning.
40+
assert wt == 'structure tree broken, assume tree is missing: cycle in structure tree'
41+
assert not e

0 commit comments

Comments
 (0)