diff options
| author | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2019-10-25 16:26:23 +0100 |
|---|---|---|
| committer | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2019-10-25 16:26:23 +0100 |
| commit | a284f4035416590f875ba9996ec5673affab5da4 (patch) | |
| tree | 1f18660cea9bb6bc441a6600a1a77d509784cc8c /tests/test_providers.py | |
| parent | Fix for alternative arXiv urls (#7) (diff) | |
| download | paper2remarkable-a284f4035416590f875ba9996ec5673affab5da4.tar.gz paper2remarkable-a284f4035416590f875ba9996ec5673affab5da4.zip | |
Fix arxiv stamp removal regex and add tests
Diffstat (limited to 'tests/test_providers.py')
| -rw-r--r-- | tests/test_providers.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/tests/test_providers.py b/tests/test_providers.py index 143fc78..1479967 100644 --- a/tests/test_providers.py +++ b/tests/test_providers.py @@ -5,11 +5,12 @@ __author__ = "G.J.J. van den Burg" """Tests""" -import unittest -import tempfile import hashlib -import shutil import os +import re +import shutil +import tempfile +import unittest from paper2remarkable.providers import ( ACM, @@ -20,8 +21,9 @@ from paper2remarkable.providers import ( PubMed, Springer, ) +from paper2remarkable.providers.arxiv import DEARXIV_TEXT_REGEX -VERBOSE = True +VERBOSE = False def md5sum(filename): @@ -35,6 +37,18 @@ def md5sum(filename): return hasher.hexdigest() +class TestArxiv(unittest.TestCase): + def test_text_regex_1(self): + key = b"arXiv:1908.03213v1 [astro.HE] 8 Aug 2019" + m = re.fullmatch(DEARXIV_TEXT_REGEX, key) + self.assertIsNotNone(m) + + def test_text_regex_2(self): + key = b"arXiv:1908.03213v1 [astro-ph.HE] 8 Aug 2019" + m = re.fullmatch(DEARXIV_TEXT_REGEX, key) + self.assertIsNotNone(m) + + class TestProviders(unittest.TestCase): @classmethod def setUpClass(cls): |
