Skip to content

Commit

Permalink
images
Browse files Browse the repository at this point in the history
  • Loading branch information
marwansalem committed Oct 2, 2022
1 parent 1926d5c commit 9b88acc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
Binary file added tests/pdfs/embedded_link_image.pdf
Binary file not shown.
Binary file added tests/pdfs/embedded_link_testcase.pdf
Binary file not shown.
21 changes: 20 additions & 1 deletion tests/test_linkrot.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,23 @@ def test_pdf_with_email_address():
pdf_with_email_addresses = linkrot.linkrot(os.path.join(curdir, "pdfs/email_test_single_page.pdf"))
references = pdf_with_email_addresses.get_references()
# there are only 2 email references in the pdf that should be excluded
assert len(references) == 0
assert len(references) == 0


def test_pdf_with_embedded_links():
pdf_with_embedded_links = linkrot.linkrot(os.path.join(curdir, "pdfs/embedded_link_testcase.pdf"))
references = pdf_with_embedded_links.get_references()

assert len(references) == 7


def test_pdf_with_embedded_link_in_image():
pdf_with_embedded_link_in_image = linkrot.linkrot(os.path.join(curdir, "pdfs/embedded_link_image.pdf"))
references = pdf_with_embedded_link_in_image.get_references()
# assert that the reference was found
assert len(references) == 1
# get the reference from the set
image_ref = references.pop()

EMBEDDED_LINK_IN_IMAGE = "https://github.com/marshalmiller/linkrot/blob/6e6fb45239f8d06e89671e2ec68a11629747355d/branding/Asset%207@4x.png"
assert image_ref.ref == EMBEDDED_LINK_IN_IMAGE

0 comments on commit 9b88acc

Please sign in to comment.