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

Function test_setlabels

tests/test_pagelabels.py:28–41  ·  view source on GitHub ↗

Check setting and inquiring page labels. - Make a PDF with 10 pages - Label pages - Inquire labels of pages - Get list of page numbers for a given label.

()

Source from the content-addressed store, hash-verified

26
27
28def test_setlabels():
29 """Check setting and inquiring page labels.
30 - Make a PDF with 10 pages
31 - Label pages
32 - Inquire labels of pages
33 - Get list of page numbers for a given label.
34 """
35 doc = make_doc()
36 doc.set_page_labels(make_labels())
37 page_labels = [p.get_label() for p in doc]
38 answer = ["A-1", "A-2", "A-3", "A-4", "I", "II", "III", "IV", "V", "VI"]
39 assert page_labels == answer, f"page_labels={page_labels}"
40 assert doc.get_page_numbers("V") == [8]
41 assert doc.get_page_labels() == make_labels()
42
43
44def test_labels_styleA():

Callers

nothing calls this directly

Calls 6

make_docFunction · 0.85
make_labelsFunction · 0.85
set_page_labelsMethod · 0.80
get_labelMethod · 0.80
get_page_numbersMethod · 0.80
get_page_labelsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…