Example #1
0
 def test_one_jan(self):
     # 1 Jan is a holiday so only two days are counted
     v = calculate_business_hours("2020-01-01", "2020-01-03")
     self.assertEqual(v.body, b"64800")
Example #2
0
 def test_easter(self):
     # Make sure easter does not count
     v = calculate_business_hours("2020-04-10", "2020-04-13")
     self.assertEqual(v.body, b"0")
Example #3
0
 def test_holiday_on_sunday(self):
     # Make sure the Monday after a public holiday is not counted. 9 Aug 2020 lands on a Sunday
     v = calculate_business_hours("2020-08-08", "2020-08-10")
     self.assertEqual(v.body, b"0")
Example #4
0
 def test_large_range(self):
     # Large range
     v = calculate_business_hours("1582-01-01", "3099-12-31")
     self.assertEqual(v.body, b"12318739200")
Example #5
0
 def test_max_end_year(self):
     # The max end year
     year = utils.END_YEAR
     v = calculate_business_hours("2020-01-01", "%s-01-03" % year)
     self.assertIn(b"The date range must be between the years", v.body)
Example #6
0
 def test_min_start_year(self):
     # The min start year
     year = utils.START_YEAR - 1
     v = calculate_business_hours("%s-01-01" % year, "2020-01-03")
     self.assertIn(b"The date range must be between the years", v.body)
Example #7
0
 def test_end_time_fail(self):
     # Invalid end date
     v = calculate_business_hours("2020-01-01", "3099-01-03T")
     self.assertIn(b"End time invalid:", v.body)
Example #8
0
 def test_start_time_fail(self):
     # Invalid start date
     v = calculate_business_hours("2020-01-01T", "2020-01-03")
     self.assertIn(b"Start time invalid:", v.body)