[Python-checkins] CVS: python/dist/src/Lib/test test_email.py,1.18.2.1,1.18.2.2

Jack Jansen jackjansen@users.sourceforge.net
2001年11月20日 12:17:43 -0800


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv22356/Python/Lib/test
Modified Files:
 Tag: r22b2-branch
	test_email.py 
Log Message:
More changes to the formatdate epoch test: the Mac epoch is in localtime,
so east of GMT it falls in 1903:-( Changed the test to obtain the epoch in both local time and GMT, and do the right thing in the comparisons. As a sanity measure also check that day/month is Jan 1.
Index: test_email.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_email.py,v
retrieving revision 1.18.2.1
retrieving revision 1.18.2.2
diff -C2 -d -r1.18.2.1 -r1.18.2.2
*** test_email.py	2001年11月20日 20:13:42	1.18.2.1
--- test_email.py	2001年11月20日 20:17:40	1.18.2.2
***************
*** 922,931 ****
 def test_formatdate(self):
 now = 1005327232.109884
! epoch = time.gmtime(0)[0]
 # When does the epoch start?
! if epoch == 1970:
 # traditional Unix epoch
 matchdate = 'Fri, 09 Nov 2001 17:33:52 -0000'
! elif epoch == 1904:
 # Mac epoch
 matchdate = 'Sat, 09 Nov 1935 16:33:52 -0000'
--- 922,932 ----
 def test_formatdate(self):
 now = 1005327232.109884
! gm_epoch = time.gmtime(0)[0:3]
! loc_epoch = time.localtime(0)[0:3]
 # When does the epoch start?
! if gm_epoch == (1970, 1, 1):
 # traditional Unix epoch
 matchdate = 'Fri, 09 Nov 2001 17:33:52 -0000'
! elif loc_epoch == (1904, 1, 1):
 # Mac epoch
 matchdate = 'Sat, 09 Nov 1935 16:33:52 -0000'

AltStyle によって変換されたページ (->オリジナル) /