File: test_page_links.py

package info (click to toggle)
pymupdf 1.25.4%2Bds1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 98,632 kB
  • sloc: python: 43,379; ansic: 75; makefile: 6
file content (17 lines) | stat: -rw-r--r-- 367 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import pymupdf

import os


def test_page_links_generator():
    # open some arbitrary PDF
    path = os.path.abspath(f"{__file__}/../../tests/resources/2.pdf")
    doc = pymupdf.open(path)

    # select an arbitrary page
    page = doc[-1]

    # iterate over pages.links
    link_generator = page.links()
    links = list(link_generator)
    assert len(links) == 7