Exemplo n.º 1
0
 def test_valid_day_for_february(self):
     year = randint(2000, 2999)
     for day in range(1, 29):
         with self.subTest(day=day, year=year):
             self.assertTrue(validate_day(year, 2, day))
Exemplo n.º 2
0
 def test_valid_day_for_30_days_months(self):
     for month in [4, 6, 9, 11]:
         year = randint(2000, 2999)
         for day in range(1, 31):
             with self.subTest(day=day, month=month, year=year):
                 self.assertTrue(validate_day(year, month, day))
Exemplo n.º 3
0
 def test_invalid_day_for_30_days_months(self):
     for month in [4, 6, 9, 11]:
         year = randint(2000, 3000)
         with self.subTest(month=month, year=year):
             self.assertFalse(validate_day(year, month, 31))
Exemplo n.º 4
0
 def test_invalid_day_for_31_days_months(self):
     for month in [1, 3, 5, 7, 8, 10, 12]:
         year = randint(2000, 3000)
         with self.subTest(month=month, year=year):
             self.assertFalse(validate_day(year, month, 32))
Exemplo n.º 5
0
 def test_valid_day_for_31_days_months(self):
     for month in [1, 3, 5, 7, 8, 10, 12]:
         for day in range(1, 32):
             year = randint(2000, 3000)
             with self.subTest(day=day, month=month, year=year):
                 self.assertTrue(validate_day(year, month, day))
Exemplo n.º 6
0
 def test_0_as_a_day(self):
     for month in range(1, 13):
         year = randint(2000, 3000)
         with self.subTest(month=month, year=year):
             self.assertFalse(validate_day(year, month, 0))
Exemplo n.º 7
0
 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))
Exemplo n.º 8
0
 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))