MCPcopy Index your code
hub / github.com/pymupdf/PyMuPDF / test_4702

Function test_4702

tests/test_general.py:2099–2129  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2097
2098
2099def test_4702():
2100 if os.environ.get('PYODIDE_ROOT'):
2101 # util.download() uses subprocess.
2102 print('test_4702(): not running on Pyodide - cannot run child processes.')
2103 return
2104
2105 path = util.download(
2106 'https://github.com/user-attachments/files/22403483/01995b6ca7837b52abaa24e38e8c076d.pdf',
2107 'test_4702.pdf',
2108 )
2109 with pymupdf.open(path) as document:
2110 for xref in range(1, document.xref_length()):
2111 print(f'{xref=}')
2112 try:
2113 _ = document.xref_object(xref)
2114 except Exception as e1:
2115 print(f'{e1=}')
2116 try:
2117 document.update_object(xref, "<<>>")
2118 except Exception as e2:
2119 print(f'{e2=}')
2120 raise
2121 wt = pymupdf.TOOLS.mupdf_warnings()
2122 assert wt == 'repairing PDF document'
2123
2124 with pymupdf.open(path) as document:
2125 for xref in range(1, document.xref_length()):
2126 print(f'{xref=}')
2127 _ = document.xref_object(xref)
2128 wt = pymupdf.TOOLS.mupdf_warnings()
2129 assert wt == 'repairing PDF document'
2130
2131
2132def test_4712():

Callers

nothing calls this directly

Calls 5

xref_lengthMethod · 0.80
xref_objectMethod · 0.80
update_objectMethod · 0.80
mupdf_warningsMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…