-
Notifications
You must be signed in to change notification settings - Fork 458
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5b9e2f1
commit 77bbc8c
Showing
2 changed files
with
18 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import fitz | ||
|
||
import os | ||
|
||
|
||
def test_page_links_generator(): | ||
# open some arbitrary PDF | ||
path = os.path.abspath(f"{__file__}/../../tests/resources/2.pdf") | ||
doc = fitz.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 |