def test_categories(self): self.assertEqual(paq.get_querystring('somestring'), '') self.assertEqual(paq.get_querystring(['randomString']), '%28cat:randomString%29') self.assertEqual(paq.get_querystring(['randcat', 'rand2']), '%28cat:randcat+OR+cat:rand2%29')
def test_all_together_now(self): self.assertEqual(paq.get_querystring(['cs.AI', 'cs.INVENTED'], 'some title', 'some author', 'some abstract', 'journal ref'), '%28cat:cs.AI+OR+cat:cs.INVENTED%29+AND+' 'ti:%22some+title%22+AND+' 'au:%22some+author%22+AND+' 'abs:%22some+abstract%22+AND+' 'jr:%22journal+ref%22')
def test_journal_ref(self): self.assertEqual(paq.get_querystring(journal_ref='Phys Rev Lett'), 'jr:%22Phys+Rev+Lett%22')
def test_abstract(self): self.assertEqual(paq.get_querystring(abstract='some abstract'), 'abs:%22some+abstract%22')
def test_authors(self): self.assertEqual(paq.get_querystring(authors='some author name'), 'au:%22some+author+name%22')
def test_title(self): self.assertEqual(paq.get_querystring(title=''), '') self.assertEqual(paq.get_querystring(title='some random title'), 'ti:%22some+random+title%22')
def test_categories_converts_arxivcategories(self): self.assertEqual(paq.get_querystring(['rand1', ArxivCategory.cs_AI, 'otherRandomString']), '%28cat:rand1+OR+cat:cs.AI+OR+' 'cat:otherRandomString%29')
def test_empty(self): self.assertEqual(paq.get_querystring(), '')