@@ -430,6 +430,26 @@ def test_thirteenth_month(self):
430430 with self .assertRaises (calendar .IllegalMonthError ):
431431 calendar .monthrange (2004 , 13 )
432432
433+ class LeapdaysTestCase (unittest .TestCase ):
434+ def test_no_range (self ):
435+ # test when no range i.e. two identical years as args
436+ self .assertEqual (calendar .leapdays (2010 ,2010 ), 0 )
437+
438+ def test_no_leapdays (self ):
439+ # test when no leap years in range
440+ self .assertEqual (calendar .leapdays (2010 ,2011 ), 0 )
441+
442+ def test_no_leapdays_upper_boundary (self ):
443+ # test no leap years in range, when upper boundary is a leap year
444+ self .assertEqual (calendar .leapdays (2010 ,2012 ), 0 )
445+
446+ def test_one_leapday_lower_boundary (self ):
447+ # test when one leap year in range, lower boundary is leap year
448+ self .assertEqual (calendar .leapdays (2012 ,2013 ), 1 )
449+
450+ def test_several_leapyears_in_range (self ):
451+ self .assertEqual (calendar .leapdays (1997 ,2020 ), 5 )
452+
433453
434454def test_main ():
435455 support .run_unittest (
@@ -439,6 +459,7 @@ def test_main():
439459 SundayTestCase ,
440460 TimegmTestCase ,
441461 MonthRangeTestCase ,
462+ LeapdaysTestCase ,
442463 )
443464
444465
0 commit comments