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

Function test_3758

tests/test_annots.py:438–456  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

436 assert rms < 1
437
438def test_3758():
439 # This test requires input file that is not public, so is usually not
440 # available.
441 path = os.path.normpath(f'{__file__}/../../../test_3758.pdf')
442 if not os.path.exists(path):
443 print(f'test_3758(): not running because does not exist: {path=}.')
444 return
445 import json
446 with pymupdf.open(path) as document:
447 for page in document:
448 info = json.loads(page.get_text('json', flags=pymupdf.TEXTFLAGS_TEXT))
449 for block_ind, block in enumerate(info['blocks']):
450 for line_ind, line in enumerate(block['lines']):
451 for span_ind, span in enumerate(line['spans']):
452 # print(span)
453 page.add_redact_annot(pymupdf.Rect(*span['bbox']))
454 page.apply_redactions()
455 wt = pymupdf.TOOLS.mupdf_warnings()
456 assert wt
457
458
459def test_parent():

Callers

nothing calls this directly

Calls 4

add_redact_annotMethod · 0.80
apply_redactionsMethod · 0.80
mupdf_warningsMethod · 0.80
get_textMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…