Skip to content

Commit 8d0ad7d

Browse files
tests/test_general.py: added test_4702().
Currently missing preliminary code so doesn't actually reproduce the problem.
1 parent a8fca04 commit 8d0ad7d

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/test_general.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2082,3 +2082,31 @@ def test_4590():
20822082
# Check pymupdf.Document.scrub() works.
20832083
with pymupdf.open(path) as document:
20842084
document.scrub()
2085+
2086+
2087+
def test_4702():
2088+
path = util.download(
2089+
'https://github.com/user-attachments/files/22403483/01995b6ca7837b52abaa24e38e8c076d.pdf',
2090+
'test_4702.pdf',
2091+
)
2092+
with pymupdf.open(path) as document:
2093+
for xref in range(1, document.xref_length()):
2094+
print(f'{xref=}')
2095+
try:
2096+
_ = document.xref_object(xref)
2097+
except Exception as e1:
2098+
print(f'{e1=}')
2099+
try:
2100+
document.update_object(xref, "<<>>")
2101+
except Exception as e2:
2102+
print(f'{e2=}')
2103+
raise
2104+
wt = pymupdf.TOOLS.mupdf_warnings()
2105+
assert wt == 'repairing PDF document'
2106+
2107+
with pymupdf.open(path) as document:
2108+
for xref in range(1, document.xref_length()):
2109+
print(f'{xref=}')
2110+
_ = document.xref_object(xref)
2111+
wt = pymupdf.TOOLS.mupdf_warnings()
2112+
assert wt == 'repairing PDF document'

0 commit comments

Comments
 (0)