From: Michael W. Hudson Date: Mon, 23 Sep 2002 13:32:53 +0000 (+0000) Subject: backport bwarsaw's checkin of X-Git-Tag: v2.2.2b1~166 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=edf66107588ec36888b83bff09586d673308a581;p=thirdparty%2FPython%2Fcpython.git backport bwarsaw's checkin of 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. --- diff --git a/Lib/test/test_rfc822.py b/Lib/test/test_rfc822.py index 259c058de2d6..470b92878fe1 100644 --- a/Lib/test/test_rfc822.py +++ b/Lib/test/test_rfc822.py @@ -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 '), + ('Cynthia Person', 'cperson@dom.ain')) + def test_main(): test_support.run_unittest(MessageTestCase)