Skip to content

Commit 21b1105

Browse files
committed
Test that citations per year are filled correctly
1 parent da00e4c commit 21b1105

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
@@ -560,6 +560,15 @@ def test_bin_citations_by_year(self):
560560
self.assertLessEqual(y_lo, y_hi)
561561
self.assertLessEqual(sum(cpy[y] for y in range(y_lo, y_hi+1)), 1000)
562562

563+
def test_cites_per_year(self):
564+
"""Test that the cites_per_year is correctly filled in,
565+
including any gap years.
566+
"""
567+
author = scholarly.search_author_id('DW_bVcEAAAAJ')
568+
scholarly.fill(author, sections=['counts'])
569+
cpy = {2014: 1, 2015: 2, 2016: 2, 2017: 0, 2018: 2, 2019: 1, 2020: 12, 2021: 21, 2022: 35}
570+
for year, count in cpy.items():
571+
self.assertEqual(author['cites_per_year'][year], count)
563572

564573
class TestScholarlyWithProxy(unittest.TestCase):
565574
@classmethod

0 commit comments

Comments
 (0)