[Python-checkins] python/dist/src/Lib/email/test test_email.py, 1.63, 1.64

anthonybaxter at users.sourceforge.net anthonybaxter at users.sourceforge.net
Mon Oct 11 15:53:16 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib/email/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26235/Lib/email/test

Modified Files:
	test_email.py 
Log Message:
Added a usegmt flag to email.Utils.formatdate - this allows it to be 
used to replace rfc822.formatdate for protocols like HTTP (where 'GMT' must
be the timezone string).


Index: test_email.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- test_email.py	9 Oct 2004 22:57:33 -0000	1.63
+++ test_email.py	11 Oct 2004 13:53:08 -0000	1.64
@@ -2037,6 +2037,15 @@
             Utils.parsedate(Utils.formatdate(now, localtime=True))[:6],
             time.localtime(now)[:6])
 
+    def test_formatdate_usegmt(self):
+        now = time.time()
+        self.assertEqual(
+            Utils.formatdate(now, localtime=False),
+            time.strftime('%a, %d %b %Y %H:%M:%S -0000', time.gmtime(now)))
+        self.assertEqual(
+            Utils.formatdate(now, localtime=False, usegmt=True),
+            time.strftime('%a, %d %b %Y %H:%M:%S GMT', time.gmtime(now)))
+
     def test_parsedate_none(self):
         self.assertEqual(Utils.parsedate(''), None)
 



More information about the Python-checkins mailing list