def test_2100(self): self.assertFalse(is_leap_year(2100))
def test_2012(self): self.assertTrue(is_leap_year(2012))
def test_2000(self): self.assertTrue(is_leap_year(2000))
def test_2001(self): self.assertFalse(is_leap_year(2001))
def test_invalid_day_for_february_not_leap_year(self): leap_years = [year for year in range(2000, 3000) if is_leap_year(year)] for year in [year for year in range(2000, 3000) if year not in leap_years]: with self.subTest(year=year): self.assertFalse(validate_day(year, 2, 29))
def test_valid_day_for_february_in_leap_years(self): leap_years = [year for year in range(2000, 3000) if is_leap_year(year)] for day in range(1, 30): year = choice(leap_years) with self.subTest(day=day, year=year): self.assertTrue(validate_day(year, 2, day))