Skip to content

Commit fb47ead

Browse files
committed
Add a unit test to handle 302/404
1 parent 389082b commit fb47ead

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test_module.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,15 @@ def test_cites_per_year(self):
574574
for year, count in cpy.items():
575575
self.assertEqual(author['cites_per_year'][year], count)
576576

577+
def test_redirect(self):
578+
"""Test that we can handle redirects when the scholar_id is approximate.
579+
"""
580+
author = scholarly.search_author_id("oMaIg8sAAAAJ")
581+
self.assertEqual(author["scholar_id"], "PEJ42J0AAAAJ")
582+
scholarly.fill(author, sections=["basics"])
583+
self.assertEqual(author["name"], "Kiran Bhatia")
584+
self.assertGreaterEqual(author["citedby"], 135)
585+
577586
class TestScholarlyWithProxy(unittest.TestCase):
578587
@classmethod
579588
def setUpClass(cls):

0 commit comments

Comments
 (0)