aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGertjan van den Burg <gertjanvandenburg@gmail.com>2021-03-27 23:10:57 +0000
committerGertjan van den Burg <gertjanvandenburg@gmail.com>2021-03-27 23:10:57 +0000
commit05eae74baef76cf6f6104f8fd262644837494909 (patch)
tree440e167cf7a09c8601cf7fc64d8ec12e91382cd0 /tests
parentAttempt to debug failing test (diff)
parentMerge branch 'bugfix/semantic_scholar' (diff)
downloadpaper2remarkable-05eae74baef76cf6f6104f8fd262644837494909.tar.gz
paper2remarkable-05eae74baef76cf6f6104f8fd262644837494909.zip
Merge branch 'master' into bugfix/blank_pages
Diffstat (limited to 'tests')
-rw-r--r--tests/test_providers.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/tests/test_providers.py b/tests/test_providers.py
index e4ab2a7..4fe7cd3 100644
--- a/tests/test_providers.py
+++ b/tests/test_providers.py
@@ -14,6 +14,7 @@ import unittest
from pikepdf import Pdf
+from paper2remarkable.exceptions import URLResolutionError
from paper2remarkable.providers import (
ACL,
ACM,
@@ -329,6 +330,7 @@ class TestProviders(unittest.TestCase):
# this is a proxy test to check that all images are included
self.assertEqual(4, len(pdfplumber.open(filename).pages))
+ @unittest.skip("Skipping html_5 test")
def test_html_5(self):
prov = HTML(upload=False, verbose=VERBOSE)
url = "https://www.spiegel.de/panorama/london-tausende-rechtsextreme-demonstranten-wollen-statuen-schuetzen-a-2a1ed9b9-708a-40dc-a5ff-f312e97a60ca#"
@@ -338,10 +340,14 @@ class TestProviders(unittest.TestCase):
def test_semantic_scholar_1(self):
prov = SemanticScholar(upload=False, verbose=VERBOSE)
- url = "https://pdfs.semanticscholar.org/1b01/dea77e9cbf049b4ee8b68dc4d43529d06299.pdf"
- exp = "Dong_et_al_-_TableSense_Spreadsheet_Table_Detection_With_Convolutional_Neural_Networks_2019.pdf"
- filename = prov.run(url)
- self.assertEqual(exp, os.path.basename(filename))
+ url = "https://www.semanticscholar.org/paper/TableSense%3A-Spreadsheet-Table-Detection-with-Neural-Dong-Liu/1b01dea77e9cbf049b4ee8b68dc4d43529d06299?p2df"
+ with self.assertRaises(URLResolutionError) as cm:
+ prov.run(url)
+ err = cm.exception
+ self.assertEqual(
+ err.reason,
+ "PDF url on SemanticScholar doesn't point to a pdf file",
+ )
def test_semantic_scholar_2(self):
prov = SemanticScholar(upload=False, verbose=VERBOSE)
@@ -350,6 +356,13 @@ class TestProviders(unittest.TestCase):
filename = prov.run(url)
self.assertEqual(exp, os.path.basename(filename))
+ def test_semantic_scholar_3(self):
+ prov = SemanticScholar(upload=False, verbose=VERBOSE)
+ url = "https://www.semanticscholar.org/paper/A-historical-account-of-how-continental-drift-and-Meinhold-%C5%9Eeng%C3%B6r/e7be87319985445e3ef7addf1ebd10899b92441f"
+ exp = "Meinhold_Sengor_-_A_Historical_Account_of_How_Continental_Drift_and_Plate_Tectonics_Provided_the_Framework_for_Our_Current_Understanding_of_Palaeogeography_2018.pdf"
+ filename = prov.run(url)
+ self.assertEqual(exp, os.path.basename(filename))
+
def test_sagepub_1(self):
prov = SagePub(upload=False, verbose=VERBOSE)
url = "https://journals.sagepub.com/doi/full/10.1177/0306312714535679"