diff options
author | Anthony Baxter <anthonybaxter@gmail.com> | 2004-10-11 13:53:08 (GMT) |
---|---|---|
committer | Anthony Baxter <anthonybaxter@gmail.com> | 2004-10-11 13:53:08 (GMT) |
commit | 3dd9e461618b0964312fa3c649cf03c7bfe27827 (patch) | |
tree | b8c98e967b38f936410f4e3fddda413bc9c8db3d /Lib/email/test | |
parent | 7f468f29f49786988e4f1a005174578fc83c7eb9 (diff) | |
download | cpython-3dd9e461618b0964312fa3c649cf03c7bfe27827.zip cpython-3dd9e461618b0964312fa3c649cf03c7bfe27827.tar.gz cpython-3dd9e461618b0964312fa3c649cf03c7bfe27827.tar.bz2 |
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).
Diffstat (limited to 'Lib/email/test')
-rw-r--r-- | Lib/email/test/test_email.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py index f2aa8d7..745260e 100644 --- a/Lib/email/test/test_email.py +++ b/Lib/email/test/test_email.py @@ -2037,6 +2037,15 @@ class TestMiscellaneous(unittest.TestCase): 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) |