MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / test_4141

Function test_4141

tests/test_4141.py:6–19  ·  view source on GitHub ↗

survive missing /Resources object in a number of cases.

()

Source from the content-addressed store, hash-verified

4
5
6def test_4141():
7 """survive missing /Resources object in a number of cases."""
8 path = os.path.abspath(f"{__file__}/../../tests/resources/test_4141.pdf")
9 doc = pymupdf.open(path)
10 page = doc[0]
11 # make sure the right test file
12 assert doc.xref_get_key(page.xref, "Resources") == ("null", "null")
13 page.insert_htmlbox((100, 100, 200, 200), "Hallo") # will fail without the fix
14 doc.close()
15 doc = pymupdf.open(doc.name)
16 page = doc[0]
17 tw = pymupdf.TextWriter(page.rect)
18 tw.append((100, 100), "Hallo")
19 tw.write_text(page) # will fail without the fix

Callers

nothing calls this directly

Calls 5

appendMethod · 0.95
write_textMethod · 0.95
xref_get_keyMethod · 0.80
insert_htmlboxMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…