diff options
author | Barry Warsaw <barry@python.org> | 2001-11-19 18:38:42 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2001-11-19 18:38:42 (GMT) |
commit | 4586d2c91c812910d0aae7dfdca75741aacd72b2 (patch) | |
tree | 44f027ed4af0089d5543403e9187ebebd05fd387 | |
parent | e5739a69a755000143849d7f776c4ff2ef8b690a (diff) | |
download | cpython-4586d2c91c812910d0aae7dfdca75741aacd72b2.zip cpython-4586d2c91c812910d0aae7dfdca75741aacd72b2.tar.gz cpython-4586d2c91c812910d0aae7dfdca75741aacd72b2.tar.bz2 |
test_formatdate(): Remove the unnecessary ldate calculation.
test_formatdate_zoneoffsets() => test_formatdate_localtime(): Do the
sign corrected calculation of the zone offset.
-rw-r--r-- | Lib/test/test_email.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/test/test_email.py b/Lib/test/test_email.py index 356a4ac..7fbae5e 100644 --- a/Lib/test/test_email.py +++ b/Lib/test/test_email.py @@ -932,14 +932,17 @@ class TestMiscellaneous(unittest.TestCase): else: matchdate = "I don't understand your epoch" gdate = Utils.formatdate(now) - ldate = Utils.formatdate(now, localtime=1) self.assertEqual(gdate, matchdate) - def test_formatdate_zoneoffsets(self): + def test_formatdate_localtime(self): now = 1005327232.109884 ldate = Utils.formatdate(now, localtime=1) zone = ldate.split()[5] - offset = int(zone[:3]) * -3600 + int(zone[-2:]) * -60 + offset = int(zone[1:3]) * 3600 + int(zone[-2:]) * 60 + # Remember offset is in seconds west of UTC, but the timezone is in + # minutes east of UTC, so the signs differ. + if zone[0] == '+': + offset = -offset if time.daylight and time.localtime(now)[-1]: toff = time.altzone else: |