aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGertjan van den Burg <gertjanvandenburg@gmail.com>2020-04-04 22:46:15 +0100
committerGertjan van den Burg <gertjanvandenburg@gmail.com>2020-04-04 22:46:15 +0100
commit0075d6ac7bee0e4791790733b2e31f5a97cee2c7 (patch)
tree2e6b2d53b4b6c6411f3bf2352f451cf24c7e9837
parentReplace excepthook for nicer errors (diff)
parentCode formatting (diff)
downloadpaper2remarkable-0075d6ac7bee0e4791790733b2e31f5a97cee2c7.tar.gz
paper2remarkable-0075d6ac7bee0e4791790733b2e31f5a97cee2c7.zip
Merge branch 'master' into feature/excepthook
-rw-r--r--paper2remarkable/exceptions.py21
-rw-r--r--tests/test_ui.py18
2 files changed, 20 insertions, 19 deletions
diff --git a/paper2remarkable/exceptions.py b/paper2remarkable/exceptions.py
index 94e9470..b433ad4 100644
--- a/paper2remarkable/exceptions.py
+++ b/paper2remarkable/exceptions.py
@@ -6,10 +6,9 @@
from . import GITHUB_URL
-from subprocess import CalledProcessError
-
-GH_MSG = "\n\nIf you think this might be a bug, please raise an issue on GitHub at: {url}".format(
- url=GITHUB_URL
+GH_MSG = (
+ "\n\nIf you think this might be a bug, please raise an issue on "
+ "GitHub at:\n{url}\n".format(url=GITHUB_URL)
)
@@ -117,24 +116,26 @@ class NoPDFToolError(Error):
msg += GH_MSG
return msg
+
class UnidentifiedSourceError(Error):
"""Exception raised when the input is neither a local file nor a url """
def __str__(self):
msg = (
- "ERROR: Couldn't figure out what source you mean. If it's a "
- "local file, please make sure it exists."
- )
+ "ERROR: Couldn't figure out what source you mean. If it's a "
+ "local file, please make sure it exists."
+ )
msg += GH_MSG
return msg
+
class InvalidURLError(Error):
"""Exception raised when no provider can handle a url source """
def __str__(self):
msg = (
- "ERROR: Input URL is not valid, no provider can handle "
- "this source."
- )
+ "ERROR: Input URL is not valid, no provider can handle "
+ "this source."
+ )
msg += GH_MSG
return msg
diff --git a/tests/test_ui.py b/tests/test_ui.py
index fc362a0..11ed87a 100644
--- a/tests/test_ui.py
+++ b/tests/test_ui.py
@@ -160,15 +160,15 @@ class TestUI(unittest.TestCase):
"http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.123.7607&rep=rep1&type=pdf",
),
(
- HTML,
- "https://hbr.org/2019/11/getting-your-team-to-do-more-than-meet-deadlines",
- "https://hbr.org/2019/11/getting-your-team-to-do-more-than-meet-deadlines"
- ),
- (
- HTML,
- "https://www.nature.com/articles/d41586-020-00176-4",
- "https://www.nature.com/articles/d41586-020-00176-4"
- ),
+ HTML,
+ "https://hbr.org/2019/11/getting-your-team-to-do-more-than-meet-deadlines",
+ "https://hbr.org/2019/11/getting-your-team-to-do-more-than-meet-deadlines",
+ ),
+ (
+ HTML,
+ "https://www.nature.com/articles/d41586-020-00176-4",
+ "https://www.nature.com/articles/d41586-020-00176-4",
+ ),
]
for exp_prov, url, exp_url in tests:
prov, new_url, jar = choose_provider(url)