Пример #1
0
 def test_arxiv_good_doi(self, reqget):
     """Get the DOI bibtex instead of the arXiv one if possible"""
     bib = apis.get_bibentry_from_api('1710.08557', 'arXiv')
     entry = bib[list(bib)[0]]
     self.assertTrue(not 'arxiv_doi' in entry)
     self.assertEqual(entry['doi'], '10.1186/s12984-017-0305-3')
     self.assertEqual(entry['title'].lower(), 'on neuromechanical approaches for the study of biological and robotic grasp and manipulation')
Пример #2
0
 def test_parses_to_bibtex(self, reqget):
     bib = apis.get_bibentry_from_api('10.1007/BF01700692', 'DOI')
     self.assertEqual(len(bib), 1)
     entry = bib[list(bib)[0]]
     self.assertEqual(entry['author'][0], 'Gödel, Kurt')
     self.assertEqual(entry['title'],
                      'Über formal unentscheidbare Sätze der Principia '
                      'Mathematica und verwandter Systeme I')
Пример #3
0
 def test_parses_to_bibtex(self, reqget):
     bib = apis.get_bibentry_from_api('10.1007/BF01700692', 'DOI')
     self.assertEqual(len(bib), 1)
     entry = bib[list(bib)[0]]
     self.assertEqual(entry['author'][0], 'Gödel, Kurt')
     self.assertEqual(
         entry['title'], 'Über formal unentscheidbare Sätze der Principia '
         'Mathematica und verwandter Systeme I')
Пример #4
0
 def test_arxiv_good_doi_force_arxiv(self, reqget):
     bib = apis.get_bibentry_from_api('1710.08557', 'arXiv', try_doi=False)
     entry = bib[list(bib)[0]]
     self.assertEqual(entry['arxiv_doi'], '10.1186/s12984-017-0305-3')
     self.assertEqual(
         entry['title'].lower(),
         'on neuromechanical approaches for the study of biological grasp and\nmanipulation'
     )
Пример #5
0
 def test_parses_to_bibtex_without_doi(self, reqget):
     bib = apis.get_bibentry_from_api('math/0211159', 'ARXIV')
     self.assertEqual(len(bib), 1)
     entry = bib[list(bib)[0]]
     self.assertEqual(entry['author'][0], 'Perelman, Grisha')
     self.assertEqual(entry['year'], '2002')
     self.assertEqual(
             entry['title'],
             'The entropy formula for the Ricci flow and its geometric applications')
Пример #6
0
 def test_parses_to_bibtex_without_doi(self, reqget):
     bib = apis.get_bibentry_from_api('math/0211159', 'ARXIV')
     self.assertEqual(len(bib), 1)
     entry = bib[list(bib)[0]]
     self.assertEqual(entry['author'][0], 'Perelman, Grisha')
     self.assertEqual(entry['year'], '2002')
     self.assertEqual(
         entry['title'],
         'The entropy formula for the Ricci flow and its geometric applications'
     )
Пример #7
0
 def test_arxiv_good_doi(self, reqget):
     """Get the DOI bibtex instead of the arXiv one if possible"""
     bib = apis.get_bibentry_from_api('1710.08557', 'arXiv')
     entry = bib[list(bib)[0]]
     self.assertTrue(not 'arxiv_doi' in entry)
     self.assertEqual(entry['doi'], '10.1186/s12984-017-0305-3')
     self.assertEqual(
         entry['title'].lower(),
         'on neuromechanical approaches for the study of biological and robotic grasp and manipulation'
     )
Пример #8
0
 def test_new_style(self, reqget):
     bib = apis.get_bibentry_from_api('astro-ph/9812133', 'arXiv')
     self.assertEqual(len(bib), 1)
     entry = bib[list(bib)[0]]
     self.assertEqual(entry['author'][0], 'Perlmutter, S.')
     self.assertEqual(entry['year'], '1999')
Пример #9
0
 def test_retrieve_fails_on_incorrect_ISBN(self, reqget):
     with self.assertRaises(apis.ReferenceNotFoundError):
         apis.get_bibentry_from_api('9' * 13, 'isbn')
Пример #10
0
 def test_parses_to_bibtex(self, reqget):
     bib = apis.get_bibentry_from_api('9782081336742', 'ISBN')
     self.assertEqual(len(bib), 1)
     entry = bib[list(bib)[0]]
     self.assertEqual(entry['author'][0], 'Poincaré, Henri')
     self.assertEqual(entry['title'], 'La science et l\'hypothèse')
Пример #11
0
 def test_retrieve_fails_on_incorrect_DOI(self, reqget):
     with self.assertRaises(apis.ReferenceNotFoundError):
         apis.get_bibentry_from_api('999999', 'doi')
Пример #12
0
 def test_arxiv_good_doi_force_arxiv(self, reqget):
     bib = apis.get_bibentry_from_api('1710.08557', 'arXiv', try_doi=False)
     entry = bib[list(bib)[0]]
     self.assertEqual(entry['arxiv_doi'], '10.1186/s12984-017-0305-3')
     self.assertEqual(entry['title'].lower(), 'on neuromechanical approaches for the study of biological grasp and\nmanipulation')
Пример #13
0
 def test_retrieve_fails_on_incorrect_DOI(self, reqget):
     with self.assertRaises(apis.ReferenceNotFoundError):
         apis.get_bibentry_from_api('999999', 'doi')
Пример #14
0
 def test_arxiv_wrong_doi(self, reqget):
     bib = apis.get_bibentry_from_api('1312.2021', 'arXiv')
     entry = bib[list(bib)[0]]
     self.assertEqual(entry['arxiv_doi'], '10.1103/INVALIDDOI.89.084044')
Пример #15
0
 def test_arxiv_wrong_doi(self, reqget):
     bib = apis.get_bibentry_from_api('1312.2021', 'arXiv')
     entry = bib[list(bib)[0]]
     self.assertEqual(entry['arxiv_doi'], '10.1103/INVALIDDOI.89.084044')
Пример #16
0
 def test_parses_to_bibtex_with_doi(self, reqget):
     bib = apis.get_bibentry_from_api('astro-ph/9812133', 'arxiv')
     self.assertEqual(len(bib), 1)
     entry = bib[list(bib)[0]]
     self.assertEqual(entry['author'][0], 'Perlmutter, S.')
     self.assertEqual(entry['year'], '1999')
Пример #17
0
 def test_parses_to_bibtex_with_doi(self, reqget):
     bib = apis.get_bibentry_from_api('astro-ph/9812133', 'arxiv')
     self.assertEqual(len(bib), 1)
     entry = bib[list(bib)[0]]
     self.assertEqual(entry['author'][0], 'Perlmutter, S.')
     self.assertEqual(entry['year'], '1999')
Пример #18
0
 def test_new_style(self, reqget):
     bib = apis.get_bibentry_from_api('astro-ph/9812133', 'arXiv')
     self.assertEqual(len(bib), 1)
     entry = bib[list(bib)[0]]
     self.assertEqual(entry['author'][0], 'Perlmutter, S.')
     self.assertEqual(entry['year'], '1999')
Пример #19
0
 def test_retrieve_fails_on_incorrect_ISBN(self, reqget):
     with self.assertRaises(apis.ReferenceNotFoundError):
         apis.get_bibentry_from_api('9' * 13, 'isbn')
Пример #20
0
 def test_parses_to_bibtex(self, reqget):
     bib = apis.get_bibentry_from_api('9782081336742', 'ISBN')
     self.assertEqual(len(bib), 1)
     entry = bib[list(bib)[0]]
     self.assertEqual(entry['author'][0], 'Poincaré, Henri')
     self.assertEqual(entry['title'], 'La science et l\'hypothèse')
Пример #21
0
 def test_arxiv_wrong_id(self, reqget):
     with self.assertRaises(apis.ReferenceNotFoundError):
         bib = apis.get_bibentry_from_api('INVALIDID', 'arxiv')
Пример #22
0
 def test_arxiv_wrong_id(self, reqget):
     with self.assertRaises(apis.ReferenceNotFoundError):
         bib = apis.get_bibentry_from_api('INVALIDID', 'arxiv')