def testGapNegativeUTCOffset(self):
# Test that we don't have a problem around gaps.
tzname = 'Eastern Standard Time'
args = self.get_args(tzname)
# Calling fromutc() alters the tzfile object
with self.context(tzname):
TOR = self.tzclass(*args)
TOR0 = self.tzclass(*args)
TOR1 = self.tzclass(*args)
t_n, t0_u, t1_u = self.get_utc_transitions(TOR, 2011, True)
# Using fresh tzfiles
t0 = t0_u.astimezone(TOR0)
t1 = t1_u.astimezone(TOR1)
self.assertEqual(t0.replace(tzinfo=None),
t_n)
self.assertEqual(t1.replace(tzinfo=None),
t_n + timedelta(hours=2))
self.assertNotEqual(t0, t1)
self.assertEqual(t0.utcoffset(), timedelta(hours=-5.0))
self.assertEqual(t1.utcoffset(), timedelta(hours=-4.0))
评论列表
文章目录