@@ -264,12 +264,16 @@ def test_search_author_id_filled(self):
264264 self .assertEqual (author ['interests' ], [])
265265 self .assertEqual (author ['public_access' ]['available' ], 0 )
266266 self .assertEqual (author ['public_access' ]['not_available' ], 0 )
267- self .assertGreaterEqual (author ['citedby' ], 2067 ) # TODO: maybe change
267+ self .assertGreaterEqual (author ['citedby' ], 2090 )
268268 self .assertGreaterEqual (len (author ['publications' ]), 218 )
269+ cpy = {1986 :4 , 2011 : 137 , 2018 : 100 }
270+ for year , count in cpy .items ():
271+ self .assertEqual (author ["cites_per_year" ][year ], count )
269272 pub = author ['publications' ][1 ]
270273 self .assertEqual (pub ["citedby_url" ],
271274 "https://scholar.google.com/scholar?oi=bibs&hl=en&cites=9976400141451962702" )
272275
276+
273277 def test_extract_author_id_list (self ):
274278 '''
275279 This unit test tests the extraction of the author id field from the html to populate the `author_id` field
@@ -570,6 +574,15 @@ def test_cites_per_year(self):
570574 for year , count in cpy .items ():
571575 self .assertEqual (author ['cites_per_year' ][year ], count )
572576
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+
573586class TestScholarlyWithProxy (unittest .TestCase ):
574587 @classmethod
575588 def setUpClass (cls ):
0 commit comments