|  | @@ -574,38 +574,38 @@ def patch_crontab_nowfun(cls, retval):
 | 
											
												
													
														|  |  class test_crontab_parser(unittest.TestCase):
 |  |  class test_crontab_parser(unittest.TestCase):
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      def test_parse_star(self):
 |  |      def test_parse_star(self):
 | 
											
												
													
														|  | -        self.assertEquals(crontab_parser(24).parse('*'), set(range(24)))
 |  | 
 | 
											
												
													
														|  | -        self.assertEquals(crontab_parser(60).parse('*'), set(range(60)))
 |  | 
 | 
											
												
													
														|  | -        self.assertEquals(crontab_parser(7).parse('*'), set(range(7)))
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(crontab_parser(24).parse('*'), set(range(24)))
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(crontab_parser(60).parse('*'), set(range(60)))
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(crontab_parser(7).parse('*'), set(range(7)))
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      def test_parse_range(self):
 |  |      def test_parse_range(self):
 | 
											
												
													
														|  | -        self.assertEquals(crontab_parser(60).parse('1-10'),
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(crontab_parser(60).parse('1-10'),
 | 
											
												
													
														|  |                            set(range(1, 10 + 1)))
 |  |                            set(range(1, 10 + 1)))
 | 
											
												
													
														|  | -        self.assertEquals(crontab_parser(24).parse('0-20'),
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(crontab_parser(24).parse('0-20'),
 | 
											
												
													
														|  |                            set(range(0, 20 + 1)))
 |  |                            set(range(0, 20 + 1)))
 | 
											
												
													
														|  | -        self.assertEquals(crontab_parser().parse('2-10'),
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(crontab_parser().parse('2-10'),
 | 
											
												
													
														|  |                            set(range(2, 10 + 1)))
 |  |                            set(range(2, 10 + 1)))
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      def test_parse_groups(self):
 |  |      def test_parse_groups(self):
 | 
											
												
													
														|  | -        self.assertEquals(crontab_parser().parse('1,2,3,4'),
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(crontab_parser().parse('1,2,3,4'),
 | 
											
												
													
														|  |                            set([1, 2, 3, 4]))
 |  |                            set([1, 2, 3, 4]))
 | 
											
												
													
														|  | -        self.assertEquals(crontab_parser().parse('0,15,30,45'),
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(crontab_parser().parse('0,15,30,45'),
 | 
											
												
													
														|  |                            set([0, 15, 30, 45]))
 |  |                            set([0, 15, 30, 45]))
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      def test_parse_steps(self):
 |  |      def test_parse_steps(self):
 | 
											
												
													
														|  | -        self.assertEquals(crontab_parser(8).parse('*/2'),
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(crontab_parser(8).parse('*/2'),
 | 
											
												
													
														|  |                            set([0, 2, 4, 6]))
 |  |                            set([0, 2, 4, 6]))
 | 
											
												
													
														|  | -        self.assertEquals(crontab_parser().parse('*/2'),
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(crontab_parser().parse('*/2'),
 | 
											
												
													
														|  |                            set(i * 2 for i in xrange(30)))
 |  |                            set(i * 2 for i in xrange(30)))
 | 
											
												
													
														|  | -        self.assertEquals(crontab_parser().parse('*/3'),
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(crontab_parser().parse('*/3'),
 | 
											
												
													
														|  |                            set(i * 3 for i in xrange(20)))
 |  |                            set(i * 3 for i in xrange(20)))
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      def test_parse_composite(self):
 |  |      def test_parse_composite(self):
 | 
											
												
													
														|  | -        self.assertEquals(crontab_parser(8).parse('*/2'), set([0, 2, 4, 6]))
 |  | 
 | 
											
												
													
														|  | -        self.assertEquals(crontab_parser().parse('2-9/5'), set([5]))
 |  | 
 | 
											
												
													
														|  | -        self.assertEquals(crontab_parser().parse('2-10/5'), set([5, 10]))
 |  | 
 | 
											
												
													
														|  | -        self.assertEquals(crontab_parser().parse('2-11/5,3'), set([3, 5, 10]))
 |  | 
 | 
											
												
													
														|  | -        self.assertEquals(crontab_parser().parse('2-4/3,*/5,0-21/4'),
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(crontab_parser(8).parse('*/2'), set([0, 2, 4, 6]))
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(crontab_parser().parse('2-9/5'), set([5]))
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(crontab_parser().parse('2-10/5'), set([5, 10]))
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(crontab_parser().parse('2-11/5,3'), set([3, 5, 10]))
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(crontab_parser().parse('2-4/3,*/5,0-21/4'),
 | 
											
												
													
														|  |                  set([0, 3, 4, 5, 8, 10, 12, 15, 16,
 |  |                  set([0, 3, 4, 5, 8, 10, 12, 15, 16,
 | 
											
												
													
														|  |                      20, 25, 30, 35, 40, 45, 50, 55]))
 |  |                      20, 25, 30, 35, 40, 45, 50, 55]))
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -650,45 +650,45 @@ class test_crontab_remaining_estimate(unittest.TestCase):
 | 
											
												
													
														|  |      def test_next_minute(self):
 |  |      def test_next_minute(self):
 | 
											
												
													
														|  |          next = self.next_ocurrance(crontab(),
 |  |          next = self.next_ocurrance(crontab(),
 | 
											
												
													
														|  |                                     datetime(2010, 9, 11, 14, 30, 15))
 |  |                                     datetime(2010, 9, 11, 14, 30, 15))
 | 
											
												
													
														|  | -        self.assertEquals(next, datetime(2010, 9, 11, 14, 31))
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(next, datetime(2010, 9, 11, 14, 31))
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      def test_not_next_minute(self):
 |  |      def test_not_next_minute(self):
 | 
											
												
													
														|  |          next = self.next_ocurrance(crontab(),
 |  |          next = self.next_ocurrance(crontab(),
 | 
											
												
													
														|  |                                     datetime(2010, 9, 11, 14, 59, 15))
 |  |                                     datetime(2010, 9, 11, 14, 59, 15))
 | 
											
												
													
														|  | -        self.assertEquals(next, datetime(2010, 9, 11, 15, 0))
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(next, datetime(2010, 9, 11, 15, 0))
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      def test_this_hour(self):
 |  |      def test_this_hour(self):
 | 
											
												
													
														|  |          next = self.next_ocurrance(crontab(minute=[5, 42]),
 |  |          next = self.next_ocurrance(crontab(minute=[5, 42]),
 | 
											
												
													
														|  |                                     datetime(2010, 9, 11, 14, 30, 15))
 |  |                                     datetime(2010, 9, 11, 14, 30, 15))
 | 
											
												
													
														|  | -        self.assertEquals(next, datetime(2010, 9, 11, 14, 42))
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(next, datetime(2010, 9, 11, 14, 42))
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      def test_not_this_hour(self):
 |  |      def test_not_this_hour(self):
 | 
											
												
													
														|  |          next = self.next_ocurrance(crontab(minute=[5, 10, 15]),
 |  |          next = self.next_ocurrance(crontab(minute=[5, 10, 15]),
 | 
											
												
													
														|  |                                     datetime(2010, 9, 11, 14, 30, 15))
 |  |                                     datetime(2010, 9, 11, 14, 30, 15))
 | 
											
												
													
														|  | -        self.assertEquals(next, datetime(2010, 9, 11, 15, 5))
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(next, datetime(2010, 9, 11, 15, 5))
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      def test_today(self):
 |  |      def test_today(self):
 | 
											
												
													
														|  |          next = self.next_ocurrance(crontab(minute=[5, 42], hour=[12, 17]),
 |  |          next = self.next_ocurrance(crontab(minute=[5, 42], hour=[12, 17]),
 | 
											
												
													
														|  |                                     datetime(2010, 9, 11, 14, 30, 15))
 |  |                                     datetime(2010, 9, 11, 14, 30, 15))
 | 
											
												
													
														|  | -        self.assertEquals(next, datetime(2010, 9, 11, 17, 5))
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(next, datetime(2010, 9, 11, 17, 5))
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      def test_not_today(self):
 |  |      def test_not_today(self):
 | 
											
												
													
														|  |          next = self.next_ocurrance(crontab(minute=[5, 42], hour=[12]),
 |  |          next = self.next_ocurrance(crontab(minute=[5, 42], hour=[12]),
 | 
											
												
													
														|  |                                     datetime(2010, 9, 11, 14, 30, 15))
 |  |                                     datetime(2010, 9, 11, 14, 30, 15))
 | 
											
												
													
														|  | -        self.assertEquals(next, datetime(2010, 9, 12, 12, 5))
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(next, datetime(2010, 9, 12, 12, 5))
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      def test_weekday(self):
 |  |      def test_weekday(self):
 | 
											
												
													
														|  |          next = self.next_ocurrance(crontab(minute=30,
 |  |          next = self.next_ocurrance(crontab(minute=30,
 | 
											
												
													
														|  |                                             hour=14,
 |  |                                             hour=14,
 | 
											
												
													
														|  |                                             day_of_week="sat"),
 |  |                                             day_of_week="sat"),
 | 
											
												
													
														|  |                                     datetime(2010, 9, 11, 14, 30, 15))
 |  |                                     datetime(2010, 9, 11, 14, 30, 15))
 | 
											
												
													
														|  | -        self.assertEquals(next, datetime(2010, 9, 18, 14, 30))
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(next, datetime(2010, 9, 18, 14, 30))
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      def test_not_weekday(self):
 |  |      def test_not_weekday(self):
 | 
											
												
													
														|  |          next = self.next_ocurrance(crontab(minute=[5, 42],
 |  |          next = self.next_ocurrance(crontab(minute=[5, 42],
 | 
											
												
													
														|  |                                             day_of_week="mon-fri"),
 |  |                                             day_of_week="mon-fri"),
 | 
											
												
													
														|  |                                     datetime(2010, 9, 11, 14, 30, 15))
 |  |                                     datetime(2010, 9, 11, 14, 30, 15))
 | 
											
												
													
														|  | -        self.assertEquals(next, datetime(2010, 9, 13, 0, 5))
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(next, datetime(2010, 9, 13, 0, 5))
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  class test_crontab_is_due(unittest.TestCase):
 |  |  class test_crontab_is_due(unittest.TestCase):
 | 
											
										
											
												
													
														|  | @@ -699,25 +699,25 @@ class test_crontab_is_due(unittest.TestCase):
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      def test_default_crontab_spec(self):
 |  |      def test_default_crontab_spec(self):
 | 
											
												
													
														|  |          c = crontab()
 |  |          c = crontab()
 | 
											
												
													
														|  | -        self.assertEquals(c.minute, set(range(60)))
 |  | 
 | 
											
												
													
														|  | -        self.assertEquals(c.hour, set(range(24)))
 |  | 
 | 
											
												
													
														|  | -        self.assertEquals(c.day_of_week, set(range(7)))
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(c.minute, set(range(60)))
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(c.hour, set(range(24)))
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(c.day_of_week, set(range(7)))
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      def test_simple_crontab_spec(self):
 |  |      def test_simple_crontab_spec(self):
 | 
											
												
													
														|  |          c = crontab(minute=30)
 |  |          c = crontab(minute=30)
 | 
											
												
													
														|  | -        self.assertEquals(c.minute, set([30]))
 |  | 
 | 
											
												
													
														|  | -        self.assertEquals(c.hour, set(range(24)))
 |  | 
 | 
											
												
													
														|  | -        self.assertEquals(c.day_of_week, set(range(7)))
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(c.minute, set([30]))
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(c.hour, set(range(24)))
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(c.day_of_week, set(range(7)))
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      def test_crontab_spec_minute_formats(self):
 |  |      def test_crontab_spec_minute_formats(self):
 | 
											
												
													
														|  |          c = crontab(minute=30)
 |  |          c = crontab(minute=30)
 | 
											
												
													
														|  | -        self.assertEquals(c.minute, set([30]))
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(c.minute, set([30]))
 | 
											
												
													
														|  |          c = crontab(minute='30')
 |  |          c = crontab(minute='30')
 | 
											
												
													
														|  | -        self.assertEquals(c.minute, set([30]))
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(c.minute, set([30]))
 | 
											
												
													
														|  |          c = crontab(minute=(30, 40, 50))
 |  |          c = crontab(minute=(30, 40, 50))
 | 
											
												
													
														|  | -        self.assertEquals(c.minute, set([30, 40, 50]))
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(c.minute, set([30, 40, 50]))
 | 
											
												
													
														|  |          c = crontab(minute=set([30, 40, 50]))
 |  |          c = crontab(minute=set([30, 40, 50]))
 | 
											
												
													
														|  | -        self.assertEquals(c.minute, set([30, 40, 50]))
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(c.minute, set([30, 40, 50]))
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      def test_crontab_spec_invalid_minute(self):
 |  |      def test_crontab_spec_invalid_minute(self):
 | 
											
												
													
														|  |          self.assertRaises(ValueError, crontab, minute=60)
 |  |          self.assertRaises(ValueError, crontab, minute=60)
 | 
											
										
											
												
													
														|  | @@ -725,11 +725,11 @@ class test_crontab_is_due(unittest.TestCase):
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      def test_crontab_spec_hour_formats(self):
 |  |      def test_crontab_spec_hour_formats(self):
 | 
											
												
													
														|  |          c = crontab(hour=6)
 |  |          c = crontab(hour=6)
 | 
											
												
													
														|  | -        self.assertEquals(c.hour, set([6]))
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(c.hour, set([6]))
 | 
											
												
													
														|  |          c = crontab(hour='5')
 |  |          c = crontab(hour='5')
 | 
											
												
													
														|  | -        self.assertEquals(c.hour, set([5]))
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(c.hour, set([5]))
 | 
											
												
													
														|  |          c = crontab(hour=(4, 8, 12))
 |  |          c = crontab(hour=(4, 8, 12))
 | 
											
												
													
														|  | -        self.assertEquals(c.hour, set([4, 8, 12]))
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(c.hour, set([4, 8, 12]))
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      def test_crontab_spec_invalid_hour(self):
 |  |      def test_crontab_spec_invalid_hour(self):
 | 
											
												
													
														|  |          self.assertRaises(ValueError, crontab, hour=24)
 |  |          self.assertRaises(ValueError, crontab, hour=24)
 | 
											
										
											
												
													
														|  | @@ -737,17 +737,27 @@ class test_crontab_is_due(unittest.TestCase):
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      def test_crontab_spec_dow_formats(self):
 |  |      def test_crontab_spec_dow_formats(self):
 | 
											
												
													
														|  |          c = crontab(day_of_week=5)
 |  |          c = crontab(day_of_week=5)
 | 
											
												
													
														|  | -        self.assertEquals(c.day_of_week, set([5]))
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(c.day_of_week, set([5]))
 | 
											
												
													
														|  |          c = crontab(day_of_week='5')
 |  |          c = crontab(day_of_week='5')
 | 
											
												
													
														|  | -        self.assertEquals(c.day_of_week, set([5]))
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(c.day_of_week, set([5]))
 | 
											
												
													
														|  |          c = crontab(day_of_week='fri')
 |  |          c = crontab(day_of_week='fri')
 | 
											
												
													
														|  | -        self.assertEquals(c.day_of_week, set([5]))
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(c.day_of_week, set([5]))
 | 
											
												
													
														|  |          c = crontab(day_of_week='tuesday,sunday,fri')
 |  |          c = crontab(day_of_week='tuesday,sunday,fri')
 | 
											
												
													
														|  | -        self.assertEquals(c.day_of_week, set([0, 2, 5]))
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(c.day_of_week, set([0, 2, 5]))
 | 
											
												
													
														|  |          c = crontab(day_of_week='mon-fri')
 |  |          c = crontab(day_of_week='mon-fri')
 | 
											
												
													
														|  | -        self.assertEquals(c.day_of_week, set([1, 2, 3, 4, 5]))
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(c.day_of_week, set([1, 2, 3, 4, 5]))
 | 
											
												
													
														|  |          c = crontab(day_of_week='*/2')
 |  |          c = crontab(day_of_week='*/2')
 | 
											
												
													
														|  | -        self.assertEquals(c.day_of_week, set([0, 2, 4, 6]))
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(c.day_of_week, set([0, 2, 4, 6]))
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    def seconds_almost_equal(self, a, b, precision):
 | 
											
												
													
														|  | 
 |  | +        for index, skew in enumerate((+0.1, 0, -0.1)):
 | 
											
												
													
														|  | 
 |  | +            try:
 | 
											
												
													
														|  | 
 |  | +                self.assertAlmostEqual(a, b + skew, precision)
 | 
											
												
													
														|  | 
 |  | +            except AssertionError:
 | 
											
												
													
														|  | 
 |  | +                if index + 1 >= 3:
 | 
											
												
													
														|  | 
 |  | +                    raise
 | 
											
												
													
														|  | 
 |  | +            else:
 | 
											
												
													
														|  | 
 |  | +                break
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      def test_crontab_spec_invalid_dow(self):
 |  |      def test_crontab_spec_invalid_dow(self):
 | 
											
												
													
														|  |          self.assertRaises(ValueError, crontab, day_of_week='fooday-barday')
 |  |          self.assertRaises(ValueError, crontab, day_of_week='fooday-barday')
 | 
											
										
											
												
													
														|  | @@ -759,13 +769,13 @@ class test_crontab_is_due(unittest.TestCase):
 | 
											
												
													
														|  |          last_ran = self.now - timedelta(seconds=61)
 |  |          last_ran = self.now - timedelta(seconds=61)
 | 
											
												
													
														|  |          due, remaining = EveryMinutePeriodic().is_due(last_ran)
 |  |          due, remaining = EveryMinutePeriodic().is_due(last_ran)
 | 
											
												
													
														|  |          self.assertTrue(due)
 |  |          self.assertTrue(due)
 | 
											
												
													
														|  | -        self.assertAlmostEquals(remaining, self.next_minute, 1)
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.seconds_almost_equal(remaining, self.next_minute, 1)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      def test_every_minute_execution_is_not_due(self):
 |  |      def test_every_minute_execution_is_not_due(self):
 | 
											
												
													
														|  |          last_ran = self.now - timedelta(seconds=self.now.second)
 |  |          last_ran = self.now - timedelta(seconds=self.now.second)
 | 
											
												
													
														|  |          due, remaining = EveryMinutePeriodic().is_due(last_ran)
 |  |          due, remaining = EveryMinutePeriodic().is_due(last_ran)
 | 
											
												
													
														|  |          self.assertFalse(due)
 |  |          self.assertFalse(due)
 | 
											
												
													
														|  | -        self.assertAlmostEquals(remaining, self.next_minute, 1)
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.seconds_almost_equal(remaining, self.next_minute, 1)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      # 29th of May 2010 is a saturday
 |  |      # 29th of May 2010 is a saturday
 | 
											
												
													
														|  |      @patch_crontab_nowfun(HourlyPeriodic, datetime(2010, 5, 29, 10, 30))
 |  |      @patch_crontab_nowfun(HourlyPeriodic, datetime(2010, 5, 29, 10, 30))
 | 
											
										
											
												
													
														|  | @@ -773,7 +783,7 @@ class test_crontab_is_due(unittest.TestCase):
 | 
											
												
													
														|  |          last_ran = self.now - timedelta(seconds=61)
 |  |          last_ran = self.now - timedelta(seconds=61)
 | 
											
												
													
														|  |          due, remaining = EveryMinutePeriodic().is_due(last_ran)
 |  |          due, remaining = EveryMinutePeriodic().is_due(last_ran)
 | 
											
												
													
														|  |          self.assertTrue(due)
 |  |          self.assertTrue(due)
 | 
											
												
													
														|  | -        self.assertAlmostEquals(remaining, self.next_minute, 1)
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.seconds_almost_equal(remaining, self.next_minute, 1)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      # 30th of May 2010 is a sunday
 |  |      # 30th of May 2010 is a sunday
 | 
											
												
													
														|  |      @patch_crontab_nowfun(HourlyPeriodic, datetime(2010, 5, 30, 10, 30))
 |  |      @patch_crontab_nowfun(HourlyPeriodic, datetime(2010, 5, 30, 10, 30))
 | 
											
										
											
												
													
														|  | @@ -781,7 +791,7 @@ class test_crontab_is_due(unittest.TestCase):
 | 
											
												
													
														|  |          last_ran = self.now - timedelta(seconds=61)
 |  |          last_ran = self.now - timedelta(seconds=61)
 | 
											
												
													
														|  |          due, remaining = EveryMinutePeriodic().is_due(last_ran)
 |  |          due, remaining = EveryMinutePeriodic().is_due(last_ran)
 | 
											
												
													
														|  |          self.assertTrue(due)
 |  |          self.assertTrue(due)
 | 
											
												
													
														|  | -        self.assertAlmostEquals(remaining, self.next_minute, 1)
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.seconds_almost_equal(remaining, self.next_minute, 1)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      # 31st of May 2010 is a monday
 |  |      # 31st of May 2010 is a monday
 | 
											
												
													
														|  |      @patch_crontab_nowfun(HourlyPeriodic, datetime(2010, 5, 31, 10, 30))
 |  |      @patch_crontab_nowfun(HourlyPeriodic, datetime(2010, 5, 31, 10, 30))
 | 
											
										
											
												
													
														|  | @@ -789,68 +799,68 @@ class test_crontab_is_due(unittest.TestCase):
 | 
											
												
													
														|  |          last_ran = self.now - timedelta(seconds=61)
 |  |          last_ran = self.now - timedelta(seconds=61)
 | 
											
												
													
														|  |          due, remaining = EveryMinutePeriodic().is_due(last_ran)
 |  |          due, remaining = EveryMinutePeriodic().is_due(last_ran)
 | 
											
												
													
														|  |          self.assertTrue(due)
 |  |          self.assertTrue(due)
 | 
											
												
													
														|  | -        self.assertAlmostEquals(remaining, self.next_minute, 1)
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.seconds_almost_equal(remaining, self.next_minute, 1)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @patch_crontab_nowfun(HourlyPeriodic, datetime(2010, 5, 10, 10, 30))
 |  |      @patch_crontab_nowfun(HourlyPeriodic, datetime(2010, 5, 10, 10, 30))
 | 
											
												
													
														|  |      def test_every_hour_execution_is_due(self):
 |  |      def test_every_hour_execution_is_due(self):
 | 
											
												
													
														|  |          due, remaining = HourlyPeriodic().is_due(datetime(2010, 5, 10, 6, 30))
 |  |          due, remaining = HourlyPeriodic().is_due(datetime(2010, 5, 10, 6, 30))
 | 
											
												
													
														|  |          self.assertTrue(due)
 |  |          self.assertTrue(due)
 | 
											
												
													
														|  | -        self.assertEquals(remaining, 60 * 60)
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(remaining, 60 * 60)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @patch_crontab_nowfun(HourlyPeriodic, datetime(2010, 5, 10, 10, 29))
 |  |      @patch_crontab_nowfun(HourlyPeriodic, datetime(2010, 5, 10, 10, 29))
 | 
											
												
													
														|  |      def test_every_hour_execution_is_not_due(self):
 |  |      def test_every_hour_execution_is_not_due(self):
 | 
											
												
													
														|  |          due, remaining = HourlyPeriodic().is_due(datetime(2010, 5, 10, 9, 30))
 |  |          due, remaining = HourlyPeriodic().is_due(datetime(2010, 5, 10, 9, 30))
 | 
											
												
													
														|  |          self.assertFalse(due)
 |  |          self.assertFalse(due)
 | 
											
												
													
														|  | -        self.assertEquals(remaining, 60)
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(remaining, 60)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @patch_crontab_nowfun(QuarterlyPeriodic, datetime(2010, 5, 10, 10, 15))
 |  |      @patch_crontab_nowfun(QuarterlyPeriodic, datetime(2010, 5, 10, 10, 15))
 | 
											
												
													
														|  |      def test_first_quarter_execution_is_due(self):
 |  |      def test_first_quarter_execution_is_due(self):
 | 
											
												
													
														|  |          due, remaining = QuarterlyPeriodic().is_due(
 |  |          due, remaining = QuarterlyPeriodic().is_due(
 | 
											
												
													
														|  |                              datetime(2010, 5, 10, 6, 30))
 |  |                              datetime(2010, 5, 10, 6, 30))
 | 
											
												
													
														|  |          self.assertTrue(due)
 |  |          self.assertTrue(due)
 | 
											
												
													
														|  | -        self.assertEquals(remaining, 15 * 60)
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(remaining, 15 * 60)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @patch_crontab_nowfun(QuarterlyPeriodic, datetime(2010, 5, 10, 10, 30))
 |  |      @patch_crontab_nowfun(QuarterlyPeriodic, datetime(2010, 5, 10, 10, 30))
 | 
											
												
													
														|  |      def test_second_quarter_execution_is_due(self):
 |  |      def test_second_quarter_execution_is_due(self):
 | 
											
												
													
														|  |          due, remaining = QuarterlyPeriodic().is_due(
 |  |          due, remaining = QuarterlyPeriodic().is_due(
 | 
											
												
													
														|  |                              datetime(2010, 5, 10, 6, 30))
 |  |                              datetime(2010, 5, 10, 6, 30))
 | 
											
												
													
														|  |          self.assertTrue(due)
 |  |          self.assertTrue(due)
 | 
											
												
													
														|  | -        self.assertEquals(remaining, 15 * 60)
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(remaining, 15 * 60)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @patch_crontab_nowfun(QuarterlyPeriodic, datetime(2010, 5, 10, 10, 14))
 |  |      @patch_crontab_nowfun(QuarterlyPeriodic, datetime(2010, 5, 10, 10, 14))
 | 
											
												
													
														|  |      def test_first_quarter_execution_is_not_due(self):
 |  |      def test_first_quarter_execution_is_not_due(self):
 | 
											
												
													
														|  |          due, remaining = QuarterlyPeriodic().is_due(
 |  |          due, remaining = QuarterlyPeriodic().is_due(
 | 
											
												
													
														|  |                              datetime(2010, 5, 10, 10, 0))
 |  |                              datetime(2010, 5, 10, 10, 0))
 | 
											
												
													
														|  |          self.assertFalse(due)
 |  |          self.assertFalse(due)
 | 
											
												
													
														|  | -        self.assertEquals(remaining, 60)
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(remaining, 60)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @patch_crontab_nowfun(QuarterlyPeriodic, datetime(2010, 5, 10, 10, 29))
 |  |      @patch_crontab_nowfun(QuarterlyPeriodic, datetime(2010, 5, 10, 10, 29))
 | 
											
												
													
														|  |      def test_second_quarter_execution_is_not_due(self):
 |  |      def test_second_quarter_execution_is_not_due(self):
 | 
											
												
													
														|  |          due, remaining = QuarterlyPeriodic().is_due(
 |  |          due, remaining = QuarterlyPeriodic().is_due(
 | 
											
												
													
														|  |                              datetime(2010, 5, 10, 10, 15))
 |  |                              datetime(2010, 5, 10, 10, 15))
 | 
											
												
													
														|  |          self.assertFalse(due)
 |  |          self.assertFalse(due)
 | 
											
												
													
														|  | -        self.assertEquals(remaining, 60)
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(remaining, 60)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @patch_crontab_nowfun(DailyPeriodic, datetime(2010, 5, 10, 7, 30))
 |  |      @patch_crontab_nowfun(DailyPeriodic, datetime(2010, 5, 10, 7, 30))
 | 
											
												
													
														|  |      def test_daily_execution_is_due(self):
 |  |      def test_daily_execution_is_due(self):
 | 
											
												
													
														|  |          due, remaining = DailyPeriodic().is_due(datetime(2010, 5, 9, 7, 30))
 |  |          due, remaining = DailyPeriodic().is_due(datetime(2010, 5, 9, 7, 30))
 | 
											
												
													
														|  |          self.assertTrue(due)
 |  |          self.assertTrue(due)
 | 
											
												
													
														|  | -        self.assertEquals(remaining, 24 * 60 * 60)
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(remaining, 24 * 60 * 60)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @patch_crontab_nowfun(DailyPeriodic, datetime(2010, 5, 10, 10, 30))
 |  |      @patch_crontab_nowfun(DailyPeriodic, datetime(2010, 5, 10, 10, 30))
 | 
											
												
													
														|  |      def test_daily_execution_is_not_due(self):
 |  |      def test_daily_execution_is_not_due(self):
 | 
											
												
													
														|  |          due, remaining = DailyPeriodic().is_due(datetime(2010, 5, 10, 7, 30))
 |  |          due, remaining = DailyPeriodic().is_due(datetime(2010, 5, 10, 7, 30))
 | 
											
												
													
														|  |          self.assertFalse(due)
 |  |          self.assertFalse(due)
 | 
											
												
													
														|  | -        self.assertEquals(remaining, 21 * 60 * 60)
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(remaining, 21 * 60 * 60)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @patch_crontab_nowfun(WeeklyPeriodic, datetime(2010, 5, 6, 7, 30))
 |  |      @patch_crontab_nowfun(WeeklyPeriodic, datetime(2010, 5, 6, 7, 30))
 | 
											
												
													
														|  |      def test_weekly_execution_is_due(self):
 |  |      def test_weekly_execution_is_due(self):
 | 
											
												
													
														|  |          due, remaining = WeeklyPeriodic().is_due(datetime(2010, 4, 30, 7, 30))
 |  |          due, remaining = WeeklyPeriodic().is_due(datetime(2010, 4, 30, 7, 30))
 | 
											
												
													
														|  |          self.assertTrue(due)
 |  |          self.assertTrue(due)
 | 
											
												
													
														|  | -        self.assertEquals(remaining, 7 * 24 * 60 * 60)
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(remaining, 7 * 24 * 60 * 60)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @patch_crontab_nowfun(WeeklyPeriodic, datetime(2010, 5, 7, 10, 30))
 |  |      @patch_crontab_nowfun(WeeklyPeriodic, datetime(2010, 5, 7, 10, 30))
 | 
											
												
													
														|  |      def test_weekly_execution_is_not_due(self):
 |  |      def test_weekly_execution_is_not_due(self):
 | 
											
												
													
														|  |          due, remaining = WeeklyPeriodic().is_due(datetime(2010, 5, 6, 7, 30))
 |  |          due, remaining = WeeklyPeriodic().is_due(datetime(2010, 5, 6, 7, 30))
 | 
											
												
													
														|  |          self.assertFalse(due)
 |  |          self.assertFalse(due)
 | 
											
												
													
														|  | -        self.assertEquals(remaining, 6 * 24 * 60 * 60 - 3 * 60 * 60)
 |  | 
 | 
											
												
													
														|  | 
 |  | +        self.assertEqual(remaining, 6 * 24 * 60 * 60 - 3 * 60 * 60)
 |