Example #1
0
 def test_in_range(self):
     range_ = dr._get_month_range(2015, 3)
     self.assertTrue(dr.in_range(date(2015, 3, 1), range_))
     self.assertTrue(dr.in_range(date(2015, 3, 15), range_))
     self.assertTrue(dr.in_range(date(2015, 3, 31), range_))
     self.assertFalse(dr.in_range(date(2014, 3, 15), range_))
     self.assertFalse(dr.in_range(date(2015, 2, 28), range_))
     self.assertFalse(dr.in_range(date(2015, 4, 1), range_))
Example #2
0
def get_weekday_count_month(year, month):
    month = _get_month_range(year, month)
    return get_weekday_count_range(month[0].weekday(), month[1].day)
Example #3
0
 def test_month_range(self):
     self.assertEqual(date(2015, 1, 31), dr._get_month_range(2015, 1)[1])
     self.assertEqual(date(2015, 2, 28), dr._get_month_range(2015, 2)[1])
     self.assertEqual(date(2000, 2, 29), dr._get_month_range(2000, 2)[1])
     self.assertEqual(date(2015, 3, 1), dr._get_month_range(2015, 3)[0])
     self.assertEqual(date(2015, 4, 30), dr._get_month_range(2015, 4)[1])