コード例 #1
0
 def test_work_week_returned_in_workday_only_mode(self):
     """Tests only workdays are returned in workday-mode."""
     self.assertEqual(
         util.parse_date_range('this week', workdays_only=True), [
             util.strict_parse_date('Mon Mar 19, 2018'),
             util.strict_parse_date('Tue Mar 20, 2018'),
             util.strict_parse_date('Wed Mar 21, 2018'),
             util.strict_parse_date('Thu Mar 22, 2018'),
             util.strict_parse_date('Fri Mar 23, 2018'),
         ])
コード例 #2
0
 def test_last_week(self):
     """Tests that last week returns all dates from last week."""
     self.assertEqual(util.parse_date_range('last week'), [
         util.strict_parse_date('Mon Mar 19, 2018'),
         util.strict_parse_date('Tue Mar 20, 2018'),
         util.strict_parse_date('Wed Mar 21, 2018'),
         util.strict_parse_date('Thu Mar 22, 2018'),
         util.strict_parse_date('Fri Mar 23, 2018'),
         util.strict_parse_date('Sat Mar 24, 2018'),
         util.strict_parse_date('Sun Mar 25, 2018'),
     ])
コード例 #3
0
 def test_yesterday_on_sunday_returns_friday_in_workdays_only_mode(self):
     """Tests yesterday on sunday is friday for workday-mode."""
     self.assertEqual(
         util.parse_date_range('yesterday', workdays_only=True), [
             util.strict_parse_date('Fri Mar 23, 2018'),
         ])
コード例 #4
0
 def test_today_on_sunday_rounds_to_friday_in_workdays_only_mode(self):
     """Tests workday-mode rounds to friday on sundays."""
     self.assertEqual(util.parse_date_range('today', workdays_only=True), [
         util.strict_parse_date('Fri Mar 23, 2018'),
     ])
コード例 #5
0
 def test_today(self):
     """Tests that today returns a single-element list for today's date."""
     self.assertEqual(util.parse_date_range('today'), [
         util.strict_parse_date('Mar 24, 2018'),
     ])
コード例 #6
0
 def test_tomorrow_on_saturday_returns_monday_in_workdays_only_mode(self):
     """Tests tomorrow on saturday is monday for workday-only mode."""
     self.assertEqual(util.parse_date_range('tomorrow', workdays_only=True),
                      [
                          util.strict_parse_date('Mon Mar 26, 2018'),
                      ])