From a284f4035416590f875ba9996ec5673affab5da4 Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Fri, 25 Oct 2019 16:26:23 +0100 Subject: Fix arxiv stamp removal regex and add tests --- tests/test_providers.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'tests') 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): -- cgit v1.2.3