def test_spring_forward_offset(self): """ Test edge cases around the spring forward time change """ pacific_zone = 'US/Pacific' no_dst_date = datetime(2015, 3, 8, 1, 59, 0) #03/08/2015 1:59 AM dst_date = datetime(2015, 3, 8, 3, 0, 0) #03/08/2015 3:00 AM expected_pacific_dst_offset = -420 expected_pacific_no_dst_offset = -480 self.assertEqual(expected_pacific_dst_offset, tools.get_offset(pacific_zone, dst_date)) self.assertEqual(expected_pacific_no_dst_offset, tools.get_offset(pacific_zone, no_dst_date))
def test_fall_back_offset(self): """ Test edge cases around the fall back time change """ pacific_zone = 'US/Pacific' dst_date = datetime(2015, 11, 1, 0, 59, 0) #11/01/2015 12:59 AM no_dst_date = datetime(2015, 11, 1, 2, 0, 0) #11/01/2015 2:00 AM expected_dst_offset = -420 expected_no_dst_offset = -480 self.assertEqual(expected_dst_offset, tools.get_offset(pacific_zone, dst_date)) self.assertEqual(expected_no_dst_offset, tools.get_offset(pacific_zone, no_dst_date))
def test_NZ_offset(self): """ Test offset in New Zealand (+12:00 hours no DST)""" nz_zone = 'NZ' no_dst_date = datetime(2015, 6, 25) expected_offset = 720 self.assertEqual(expected_offset, tools.get_offset(nz_zone, no_dst_date))