[Python-checkins] CVS: python/dist/src/Lib/test test_email.py,1.20,1.21
Barry Warsaw
bwarsaw@users.sourceforge.net
Mon, 19 Nov 2001 10:38:44 -0800
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv8765/Lib/test
Modified Files:
test_email.py
Log Message:
test_formatdate(): Remove the unnecessary ldate calculation.
test_formatdate_zoneoffsets() => test_formatdate_localtime(): Do the
sign corrected calculation of the zone offset.
Index: test_email.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_email.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** test_email.py 2001/11/19 16:31:06 1.20
--- test_email.py 2001/11/19 18:38:42 1.21
***************
*** 933,944 ****
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):
now = 1005327232.109884
ldate = Utils.formatdate(now, localtime=1)
zone = ldate.split()[5]
! offset = int(zone[:3]) * -3600 + int(zone[-2:]) * -60
if time.daylight and time.localtime(now)[-1]:
toff = time.altzone
--- 933,947 ----
matchdate = "I don't understand your epoch"
gdate = Utils.formatdate(now)
self.assertEqual(gdate, matchdate)
! def test_formatdate_localtime(self):
now = 1005327232.109884
ldate = Utils.formatdate(now, localtime=1)
zone = ldate.split()[5]
! 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