Spaces:
Sleeping
Sleeping
File size: 1,998 Bytes
75c3b48 b06418a e203fb5 b06418a e203fb5 277d92a 75c3b48 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
import unittest
import sys
sys.path.append('../')
from utils import *
import os
import shutil
class Utils(unittest.TestCase):
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).')"
max_results = 1
XRxiv_servers = ['rxiv']
search_engines = XRxivQuery(search_query, max_results, XRxiv_servers=XRxiv_servers)
test_pdf_info = search_engines.call_API()
self.assertEqual(pdf_info, str(test_pdf_info[0]))
def test_download_pdf(self):
search_query = 'Serverless Applications: Why, When, and How?'
max_results = 1
XRxiv_servers = ['rxiv']
search_engines = XRxivQuery(search_query, max_results, XRxiv_servers=XRxiv_servers)
test_pdf_info = search_engines.call_API()
search_engines.download_pdf()
dowloaded_dir = 'docs/Serverless Applications Why When and How .pdf'
self.assertTrue(os.path.exists(dowloaded_dir))
shutil.rmtree(f'docs/')
def test_distibute_max_papers(self):
XRxiv_servers = ['rxiv', 'medrxiv']
max_results = 10
max_papers_in_server = distibute_max_papers(max_results, XRxiv_servers)
self.assertEqual(max_results, np.sum(max_papers_in_server))
self.assertEqual(max_papers_in_server[2], 0)
self.assertGreater(max_papers_in_server[0],0)
self.assertGreater(max_papers_in_server[3],0)
if __name__ == '__main__':
unittest.main() |