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

Function test_4180

tests/test_textextract.py:524–542  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

522
523
524def test_4180():
525 path = os.path.normpath(f'{__file__}/../../tests/resources/test_4180.pdf')
526 with pymupdf.open(path) as document:
527 page = document[0]
528 regions = page.search_for('Reference is made')
529 for region in regions:
530 page.add_redact_annot(region, fill=(0, 0, 0))
531 page.apply_redactions()
532 pixmap = page.get_pixmap()
533 path_out = os.path.normpath(f'{__file__}/../../tests/resources/test_4180_out.png')
534 pixmap.save(path_out)
535
536 path_expected = os.path.normpath(f'{__file__}/../../tests/resources/test_4180_expected.png')
537 rms = gentle_compare.pixmaps_rms(path_expected, pixmap)
538 pixmap_diff = gentle_compare.pixmaps_diff(path_expected, pixmap)
539 path_diff = os.path.normpath(f'{__file__}/../../tests/resources/test_4180_diff.png')
540 pixmap_diff.save(path_diff)
541 print(f'{rms=}')
542 assert rms < 0.01
543
544
545def test_4182():

Callers

nothing calls this directly

Calls 5

search_forMethod · 0.80
add_redact_annotMethod · 0.80
apply_redactionsMethod · 0.80
get_pixmapMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…