localtm = _time.localtime(ts)
local = datetime(*localtm[:6])
try:
- # Extract TZ data if available
+ # Extract TZ data if available
gmtoff = localtm.tm_gmtoff
zone = localtm.tm_zone
except AttributeError:
tz = timezone(delta)
else:
tz = timezone(timedelta(seconds=-gmtoff), zone)
-
+
elif not isinstance(tz, tzinfo):
raise TypeError("tz argument must be an instance of tzinfo")
dt = self.theclass(2012, 11, 4, 6, 30, tzinfo=timezone.utc)
local = dt.astimezone()
self.assertEqual(dt, local)
- self.assertEqual(local.strftime("%z %Z"), "+0500 EST")
+ self.assertEqual(local.strftime("%z %Z"), "+0500 EST")
dt = self.theclass(2012, 11, 4, 5, 30, tzinfo=timezone.utc)
local = dt.astimezone()
self.assertEqual(dt, local)
- self.assertEqual(local.strftime("%z %Z"), "+0400 EDT")
+ self.assertEqual(local.strftime("%z %Z"), "+0400 EDT")
def test_aware_subtract(self):
cls = self.theclass