Example #1
0
 def test_days_of_jan(self):
     month = Month(year=2017, month=1)
     self.assertEqual(month.get_days_of_month(), list(range(1, 32)))
Example #2
0
 def test_days_of_feb_non_leaping(self):
     month = Month(year=2017, month=2)
     self.assertEqual(month.get_days_of_month(), list(range(1, 29)))
Example #3
0
 def test_bad_year(self):
     month = Month(year=2017, month=10)
     test_date = datetime.date(2016, 10, 11)
     self.assertFalse(month.is_in_month(test_date))
Example #4
0
 def test_date_is_in_month(self):
     month = Month(year=2017, month=10)
     test_date = datetime.date(2017, 10, 11)
     self.assertTrue(month.is_in_month(test_date))
Example #5
0
 def test_init_invalid_values(self):
     month = Month(year=0, month=0)
     now = datetime.datetime.now()
     self.assertEqual(month.get_date_readable(),
                      str(now.year) + "." + str(now.month).zfill(2) + ".")
     self.assertEqual(month.get_month_two_digits(), str(now.month).zfill(2))
Example #6
0
 def test_init_strings(self):
     month = Month(year="2017", month="08")
     self.assertEqual(month.get_date_readable(), "2017.08.")
     self.assertEqual(month.get_month_two_digits(), '08')
Example #7
0
 def test_init_numbers(self):
     month = Month(year=2017, month=8)
     self.assertEqual(month.get_date_readable(), "2017.08.")
     self.assertEqual(month.get_month_two_digits(), '08')