summaryrefslogtreecommitdiffstats
path: root/Lib/email/test
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2010-08-25 01:45:57 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2010-08-25 01:45:57 (GMT)
commit7c4bf55ffdc9d88795381d5d0fb5481f226a9d57 (patch)
tree15bd8b5a715e39c34c7adcc1e32a7c3e62df1ade /Lib/email/test
parent9128732de668e5777e135a423d3fa8b9bbd71fe1 (diff)
downloadcpython-7c4bf55ffdc9d88795381d5d0fb5481f226a9d57.zip
cpython-7c4bf55ffdc9d88795381d5d0fb5481f226a9d57.tar.gz
cpython-7c4bf55ffdc9d88795381d5d0fb5481f226a9d57.tar.bz2
Merged revisions 84310 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r84310 | r.david.murray | 2010-08-24 20:45:55 -0400 (Tue, 24 Aug 2010) | 8 lines #1194222: make parsedate always return RFC2822 four character years. Two character years are now converted to four character years using the Posix standard rule (<68 == 2000, >=68==1900). This makes the parsed date RFC2822 compliant even if the input is not. Patch and test by Jeffrey Finkelstein. ........
Diffstat (limited to 'Lib/email/test')
-rw-r--r--Lib/email/test/test_email.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py
index e1754e9..300fc21 100644
--- a/Lib/email/test/test_email.py
+++ b/Lib/email/test/test_email.py
@@ -2234,6 +2234,19 @@ class TestMiscellaneous(TestEmailBase):
eq(time.localtime(t)[:6], timetup[:6])
eq(int(time.strftime('%Y', timetup[:9])), 2003)
+ def test_parsedate_y2k(self):
+ """Test for parsing a date with a two-digit year.
+
+ Parsing a date with a two-digit year should return the correct
+ four-digit year. RFC822 allows two-digit years, but RFC2822 (which
+ obsoletes RFC822) requires four-digit years.
+
+ """
+ self.assertEqual(Utils.parsedate_tz('25 Feb 03 13:47:26 -0800'),
+ Utils.parsedate_tz('25 Feb 2003 13:47:26 -0800'))
+ self.assertEqual(Utils.parsedate_tz('25 Feb 71 13:47:26 -0800'),
+ Utils.parsedate_tz('25 Feb 1971 13:47:26 -0800'))
+
def test_parseaddr_empty(self):
self.assertEqual(Utils.parseaddr('<>'), ('', ''))
self.assertEqual(Utils.formataddr(Utils.parseaddr('<>')), '')