Skip to content

Commit 0a0ffda

Browse files
committed
Mark test_related_articles_from_author as proxy test case
1 parent ca4623a commit 0a0ffda

1 file changed

Lines changed: 24 additions & 23 deletions

File tree

test_module.py

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -372,29 +372,6 @@ def test_mandates(self):
372372
)
373373
self.assertIn(mandate, pub['mandates'])
374374

375-
def test_related_articles_from_author(self):
376-
"""
377-
Test that we obtain related articles to an article from an author
378-
"""
379-
author = scholarly.search_author_id("ImhakoAAAAAJ")
380-
scholarly.fill(author, sections=['basics', 'publications'])
381-
pub = author['publications'][0]
382-
self.assertEqual(pub['bib']['title'], 'Prospect theory: An analysis of decision under risk')
383-
self.assertEqual(pub['bib']['citation'], 'Handbook of the fundamentals of financial decision making: Part I, 99-127, 2013')
384-
related_articles = scholarly.get_related_articles(pub)
385-
# Typically, the same publication is returned as the most related article
386-
same_article = next(related_articles)
387-
self.assertEqual(pub["pub_url"], same_article["pub_url"])
388-
for key in {'title', 'pub_year'}:
389-
self.assertEqual(str(pub['bib'][key]), (same_article['bib'][key]))
390-
391-
# These may change with time
392-
related_article = next(related_articles)
393-
self.assertEqual(related_article['bib']['title'], 'Advances in prospect theory: Cumulative representation of uncertainty')
394-
self.assertEqual(related_article['bib']['pub_year'], '1992')
395-
self.assertGreaterEqual(related_article['num_citations'], 18673)
396-
self.assertIn("A Tversky", related_article['bib']['author'])
397-
398375
def test_author_custom_url(self):
399376
"""
400377
Test that we can use custom URLs for retrieving author data
@@ -745,6 +722,30 @@ def test_search_pubs_filling_publication_contents(self):
745722
self.assertTrue(f['bib']['volume'] == '18')
746723
self.assertTrue(f['bib']['pub_year'] == u'2018')
747724

725+
@unittest.skipIf(os.getenv("CONNECTION_METHOD") in {None, "none", "freeproxy"}, reason="No robust proxy setup")
726+
def test_related_articles_from_author(self):
727+
"""
728+
Test that we obtain related articles to an article from an author
729+
"""
730+
author = scholarly.search_author_id("ImhakoAAAAAJ")
731+
scholarly.fill(author, sections=['basics', 'publications'])
732+
pub = author['publications'][0]
733+
self.assertEqual(pub['bib']['title'], 'Prospect theory: An analysis of decision under risk')
734+
self.assertEqual(pub['bib']['citation'], 'Handbook of the fundamentals of financial decision making: Part I, 99-127, 2013')
735+
related_articles = scholarly.get_related_articles(pub)
736+
# Typically, the same publication is returned as the most related article
737+
same_article = next(related_articles)
738+
self.assertEqual(pub["pub_url"], same_article["pub_url"])
739+
for key in {'title', 'pub_year'}:
740+
self.assertEqual(str(pub['bib'][key]), (same_article['bib'][key]))
741+
742+
# These may change with time
743+
related_article = next(related_articles)
744+
self.assertEqual(related_article['bib']['title'], 'Advances in prospect theory: Cumulative representation of uncertainty')
745+
self.assertEqual(related_article['bib']['pub_year'], '1992')
746+
self.assertGreaterEqual(related_article['num_citations'], 18673)
747+
self.assertIn("A Tversky", related_article['bib']['author'])
748+
748749
@unittest.skipIf(os.getenv("CONNECTION_METHOD") in {None, "none", "freeproxy"}, reason="No robust proxy setup")
749750
def test_related_articles_from_publication(self):
750751
"""

0 commit comments

Comments
 (0)