def test_run(search: Search): search.limit = 14 search.limit_per_database = None acm_searcher.run(search) assert len(search.papers) == 14
def test_run(search: Search): search.limit = 20 search.limit_per_database = None search.since = datetime.date(2020, 8, 26) search.until = datetime.date(2020, 8, 26) arxiv_searcher.run(search) assert len(search.papers) == 18
def test_search(paper: Paper): paper.doi = None search = Search('this AND that', datetime.date(1969, 1, 30), datetime.date(1970, 4, 8), 2) assert len(search.papers) == 0 search.add_paper(paper) assert len(search.papers) == 1 search.add_paper(paper) assert len(search.papers) == 1 another_paper = Paper('awesome paper title 2', 'a long abstract', paper.authors, paper.publication, paper.publication_date, paper.urls) another_paper.add_database('arXiv') search.add_paper(another_paper) assert len(search.papers) == 2 assert paper == search.get_paper(paper.title, paper.publication_date, paper.doi) assert paper.publication == search.get_publication(paper.publication.title, paper.publication.issn, paper.publication.isbn) search.remove_paper(another_paper) assert len(search.papers) == 1 assert paper in search.papers search.limit_per_database = 1 with pytest.raises(OverflowError): search.add_paper(another_paper) search.limit_per_database = 2 search.add_paper(another_paper) assert len(search.papers) == 2 another_paper_2 = copy.deepcopy(paper) another_paper_2.title = 'awesome paper title 3' another_paper_2.abstract = 'a long abstract' another_paper_2.databases = set() with pytest.raises(ValueError): search.add_paper(another_paper_2) another_paper_2.add_database('arXiv') with pytest.raises(OverflowError): search.add_paper(another_paper_2) search.merge_duplications() assert len(search.papers) == 1 publication_title = 'FAKE-TITLE' publication_issn = 'FAKE-ISSN' publication_isbn = 'FAKE-ISBN' assert search.get_publication_key( publication_title, publication_issn, publication_isbn) == f'ISBN-{publication_isbn.lower()}' assert search.get_publication_key( publication_title, publication_issn) == f'ISSN-{publication_issn.lower()}' assert search.get_publication_key( publication_title) == f'TITLE-{publication_title.lower()}'