diff options
| author | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2021-03-02 21:57:32 +0000 |
|---|---|---|
| committer | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2021-03-02 21:57:32 +0000 |
| commit | 8aef3ef34fd3f7443919c0f7294e4b1c909fdcf4 (patch) | |
| tree | 7c730b1868062ab11eaa649f6f35734f50fdf36c /tests/test_providers.py | |
| parent | Remove unnecessary check in arXiv unit test (diff) | |
| parent | tests: add additional test about ToC, this time with arXiv provider (diff) | |
| download | paper2remarkable-8aef3ef34fd3f7443919c0f7294e4b1c909fdcf4.tar.gz paper2remarkable-8aef3ef34fd3f7443919c0f7294e4b1c909fdcf4.zip | |
Merge branch 'Kazy-pikepdf'
Diffstat (limited to 'tests/test_providers.py')
| -rw-r--r-- | tests/test_providers.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_providers.py b/tests/test_providers.py index eaeb8aa..af69c64 100644 --- a/tests/test_providers.py +++ b/tests/test_providers.py @@ -11,6 +11,7 @@ import pdfplumber import shutil import tempfile import unittest +from pikepdf import Pdf from paper2remarkable.providers import ( ACL, @@ -34,6 +35,7 @@ from paper2remarkable.providers import ( Springer, TandFOnline, ) +from paper2remarkable.utils import download_url VERBOSE = False @@ -438,6 +440,24 @@ class TestProviders(unittest.TestCase): filename = prov.run(url) self.assertEqual(exp, os.path.basename(filename)) + def test_local_file_copy_toc(self): + """Make sure the table of content is kept after processing.""" + local_filename = "test.pdf" + download_url("https://arxiv.org/pdf/1711.03512.pdf", local_filename) + prov = LocalFile(upload=False, verbose=VERBOSE) + filename = prov.run(local_filename) + with Pdf.open(filename) as pdf: + with pdf.open_outline() as outline: + assert len(outline.root) > 0 + + def test_arxiv_copy_toc(self): + """Make sure the table of content is kept after processing when using the arXiv provider.""" + prov = Arxiv(upload=False, verbose=VERBOSE) + filename = prov.run("https://arxiv.org/abs/1711.03512") + with Pdf.open(filename) as pdf: + with pdf.open_outline() as outline: + assert len(outline.root) > 0 + if __name__ == "__main__": unittest.main() |
