import unittest import sys sys.path.append('../') from utils import * import os import shutil class Utils(unittest.TestCase): def test_download_pdf(self): pdf_info = [('Serverless Applications Why When and How ', 'http://arxiv.org/pdf/2009.08173v2', ['Simon Eismann', 'Joel Scheuner', 'Erwin van Eyk', 'Maximilian Schwinger', 'Johannes Grohmann', 'Cristina L. Abad', 'Alexandru Iosup'], ['cs.SE', 'cs.DC', 'D.2.11; D.2.0; D.2.1'], 'docs', 'Simon Eismann, Joel Scheuner, Erwin van Eyk, Maximilian Schwinger, Johannes Grohmann, Cristina L. Abad, Alexandru Iosup, Serverless Applications Why When and How . arXiv [cs.SE] (2020), (available at http://arxiv.org/pdf/2009.08173v2).')] download_pdf(pdf_info) dowloaded_dir = 'docs/Serverless Applications Why When and How .pdf' self.assertTrue(os.path.exists(dowloaded_dir)) shutil.rmtree(f'docs/') def test_arXiv_API(self): search_query = 'Tools for Landscape Analysis of Optimisation Problems in Procedural Content Generation for Games' pdf_info = "('Tools for Landscape Analysis of Optimisation Problems in Procedural Content Generation for Games', 'http://arxiv.org/pdf/2302.08479v1', ['Vanessa Volz', 'Boris Naujoks', 'Pascal Kerschke', 'Tea Tusar'], ['cs.AI'], 'docs', 'Vanessa Volz, Boris Naujoks, Pascal Kerschke, Tea Tusar, Tools for Landscape Analysis of Optimisation Problems in Procedural Content Generation for Games. arXiv [cs.AI] (2023), (available at http://arxiv.org/pdf/2302.08479v1).')" test_pdf_info, test_pdf_citation = call_arXiv_API(search_query, max_results='1') self.assertEqual(pdf_info, str(test_pdf_info[0])) if __name__ == '__main__': unittest.main()