Ejemplo n.º 1
0
 def test_add_seconds_night_shift(self):
     begin = time(8, 30)
     end = time(20, 30)
     policy = Policy(weekends=(SAT, SUN), holidays=holidays, hours=(end, begin))
     # Nominal
     self.assertEqual(policy.add_seconds(datetime(2011, 3, 3, 5, 30), 3600), datetime(2011, 3, 3, 6, 30))
     self.assertEqual(policy.add_seconds(datetime(2011, 3, 2, 22, 30), 10800), datetime(2011, 3, 3, 1, 30))
Ejemplo n.º 2
0
 def test_add_seconds_no_hours(self):
     policy = Policy(weekends=(SAT, SUN), holidays=holidays, hours=None)
     # Nominal
     self.assertEqual(policy.add_seconds(datetime(2011, 3, 3, 8, 30), 3600), datetime(2011, 3, 3, 9, 30))
     # During weekend
     self.assertEqual(policy.add_seconds(datetime(2011, 3, 5, 10, 30), 3600), datetime(2011, 3, 7, 1, 0))
     # Span weekend
     self.assertEqual(policy.add_seconds(datetime(2011, 3, 4, 20, 30), 36000), datetime(2011, 3, 7, 6, 30))
Ejemplo n.º 3
0
 def test_add_seconds_night_shift(self):
     begin = time(8, 30)
     end = time(20, 30)
     policy = Policy(weekends=(SAT, SUN),
                     holidays=holidays,
                     hours=(end, begin))
     # Nominal
     self.assertEqual(policy.add_seconds(datetime(2011, 3, 3, 5, 30), 3600),
                      datetime(2011, 3, 3, 6, 30))
     self.assertEqual(
         policy.add_seconds(datetime(2011, 3, 2, 22, 30), 10800),
         datetime(2011, 3, 3, 1, 30))
Ejemplo n.º 4
0
 def test_add_seconds_no_hours(self):
     policy = Policy(weekends=(SAT, SUN), holidays=holidays, hours=None)
     # Nominal
     self.assertEqual(policy.add_seconds(datetime(2011, 3, 3, 8, 30), 3600),
                      datetime(2011, 3, 3, 9, 30))
     # During weekend
     self.assertEqual(
         policy.add_seconds(datetime(2011, 3, 5, 10, 30), 3600),
         datetime(2011, 3, 7, 1, 0))
     # Span weekend
     self.assertEqual(
         policy.add_seconds(datetime(2011, 3, 4, 20, 30), 36000),
         datetime(2011, 3, 7, 6, 30))
Ejemplo n.º 5
0
 def test_add_seconds(self):
     begin = time(8, 30)
     end = time(20, 30)
     policy = Policy(weekends=(SAT, SUN),
                     holidays=holidays,
                     hours=(begin, end))
     # Nominal
     self.assertEqual(policy.add_seconds(datetime(2011, 3, 3, 8, 30), 3600),
                      datetime(2011, 3, 3, 9, 30))
     # Before begin
     self.assertEqual(policy.add_seconds(datetime(2011, 3, 3, 7, 30), 3600),
                      datetime(2011, 3, 3, 9, 30))
     # Day before
     self.assertEqual(
         policy.add_seconds(datetime(2011, 3, 2, 22, 30), 3600),
         datetime(2011, 3, 3, 9, 30))
     # Many hours
     self.assertEqual(
         policy.add_seconds(datetime(2011, 3, 3, 6, 30), 50400),
         datetime(2011, 3, 4, 10, 30))
     # During weekend
     self.assertEqual(
         policy.add_seconds(datetime(2011, 3, 5, 10, 30), 3600),
         datetime(2011, 3, 7, 9, 30))
     # Span weekend
     self.assertEqual(
         policy.add_seconds(datetime(2011, 3, 4, 15, 30), 36000),
         datetime(2011, 3, 7, 13, 30))
Ejemplo n.º 6
0
 def test_add_seconds(self):
     begin = time(8, 30)
     end = time(20, 30)
     policy = Policy(weekends=(SAT, SUN), holidays=holidays, hours=(begin, end))
     # Nominal
     self.assertEqual(policy.add_seconds(datetime(2011, 3, 3, 8, 30), 3600), datetime(2011, 3, 3, 9, 30))
     # Before begin
     self.assertEqual(policy.add_seconds(datetime(2011, 3, 3, 7, 30), 3600), datetime(2011, 3, 3, 9, 30))
     # Day before
     self.assertEqual(policy.add_seconds(datetime(2011, 3, 2, 22, 30), 3600), datetime(2011, 3, 3, 9, 30))
     # Many hours
     self.assertEqual(policy.add_seconds(datetime(2011, 3, 3, 6, 30), 50400), datetime(2011, 3, 4, 10, 30))
     # During weekend
     self.assertEqual(policy.add_seconds(datetime(2011, 3, 5, 10, 30), 3600), datetime(2011, 3, 7, 9, 30))
     # Span weekend
     self.assertEqual(policy.add_seconds(datetime(2011, 3, 4, 15, 30), 36000), datetime(2011, 3, 7, 13, 30))