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

Barry Warsaw bwarsaw@users.sourceforge.net
Sun, 18 Nov 2001 15:16:00 -0800


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv2567

Modified Files:
	test_email.py 
Log Message:
test_formatdate(): A test that has a mild hope of working on Mac,
which has a different epoch than *nix.  Jack may need to twiddle the
details.


Index: test_email.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_email.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** test_email.py	2001/11/13 18:01:37	1.18
--- test_email.py	2001/11/18 23:15:58	1.19
***************
*** 922,928 ****
      def test_formatdate(self):
          now = 1005327232.109884
          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.  Skip if
          # we don't have strptime().
--- 922,938 ----
      def test_formatdate(self):
          now = 1005327232.109884
+         time0 = time.ctime(0)
+         # When does the epoch start?
+         if time0 == 'Wed Dec 31 19:00:00 1969':
+             # traditional Unix epoch
+             matchdate = 'Fri, 09 Nov 2001 17:33:52 -0000'
+         elif time0 == 'Fri Jan  1 00:00:00 1904':
+             # Mac epoch
+             matchdate = 'Sat, 09 Nov 1935 16:33:52 -0000'
+         else:
+             matchdate = "I don't understand your epoch"
          gdate = Utils.formatdate(now)
          ldate = Utils.formatdate(now, localtime=1)
!         self.assertEqual(gdate, matchdate)
          # It's a little tougher to test for localtime, but we'll try.  Skip if
          # we don't have strptime().