]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
backport bwarsaw's checkin of
authorMichael W. Hudson <mwh@python.net>
Mon, 23 Sep 2002 13:32:53 +0000 (13:32 +0000)
committerMichael W. Hudson <mwh@python.net>
Mon, 23 Sep 2002 13:32:53 +0000 (13:32 +0000)
    revision 1.17 of test_rfc822.py

parseaddr(): Fixed in the same way that Message.getaddrlist() was
fixed (re: SF bug #555035).  Include a unittest.

Lib/test/test_rfc822.py

index 259c058de2d6a0377fd12959411ba60091cf99cc..470b92878fe1a54f6ff113544a80e5f9235b3637 100644 (file)
@@ -194,6 +194,15 @@ class MessageTestCase(unittest.TestCase):
 ##        self.assertEqual(len(lst), OBSCENELY_LONG_HEADER_MULTIPLIER)
 
 
+    def test_parseaddr(self):
+        eq = self.assertEqual
+        eq(rfc822.parseaddr('<>'), ('', ''))
+        eq(rfc822.parseaddr('aperson@dom.ain'), ('', 'aperson@dom.ain'))
+        eq(rfc822.parseaddr('bperson@dom.ain (Bea A. Person)'),
+           ('Bea A. Person', 'bperson@dom.ain'))
+        eq(rfc822.parseaddr('Cynthia Person <cperson@dom.ain>'),
+           ('Cynthia Person', 'cperson@dom.ain'))
+
 def test_main():
     test_support.run_unittest(MessageTestCase)