diff options
author | Barry Warsaw <barry@python.org> | 2001-11-09 19:30:58 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2001-11-09 19:30:58 (GMT) |
commit | 7edd71a9f5342c5ef47a989c4582712982b1035f (patch) | |
tree | c71e419b4cbc3051a8382c0297b2ca137dc66546 /Lib/test | |
parent | 114486701aa1c4bc870a82c531aecf80442a83a6 (diff) | |
download | cpython-7edd71a9f5342c5ef47a989c4582712982b1035f.zip cpython-7edd71a9f5342c5ef47a989c4582712982b1035f.tar.gz cpython-7edd71a9f5342c5ef47a989c4582712982b1035f.tar.bz2 |
test_formatdate(): Don't do the localtime test if we don't have
strptime() -- I'm too lazy to code it otherwise.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_email.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/Lib/test/test_email.py b/Lib/test/test_email.py index 1e065e4..06925d5 100644 --- a/Lib/test/test_email.py +++ b/Lib/test/test_email.py @@ -924,16 +924,18 @@ class TestMiscellaneous(unittest.TestCase): gdate = Utils.formatdate(now) ldate = Utils.formatdate(now, localtime=1) self.assertEqual(gdate, 'Fri, 09 Nov 2001 17:33:52 -0000') - # It's a little tougher to test for localtime, but we'll try - gtime = time.strptime(gdate.split()[4], '%H:%M:%S') - ltime = time.strptime(ldate.split()[4], '%H:%M:%S') - zone = ldate.split()[5] - offset = int(zone[:3]) * -3600 + int(zone[-2:]) - if time.daylight and time.localtime(now)[-1]: - toff = time.altzone - else: - toff = time.timezone - self.assertEqual(offset, toff) + # It's a little tougher to test for localtime, but we'll try. Skip if + # we don't have strptime(). + if hasattr(time, 'striptime'): + gtime = time.strptime(gdate.split()[4], '%H:%M:%S') + ltime = time.strptime(ldate.split()[4], '%H:%M:%S') + zone = ldate.split()[5] + offset = int(zone[:3]) * -3600 + int(zone[-2:]) + if time.daylight and time.localtime(now)[-1]: + toff = time.altzone + else: + toff = time.timezone + self.assertEqual(offset, toff) |