From: Barry Warsaw Date: Wed, 22 May 2002 01:52:10 +0000 (+0000) Subject: getaddresses(): Like the change in rfc822.py, this one needs to access X-Git-Tag: v2.3c1~5623 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4be9eccbc404f8173bdbc4720421b451a5879cc0;p=thirdparty%2FPython%2Fcpython.git getaddresses(): Like the change in rfc822.py, this one needs to access the AddressList.addresslist attribute directly. Also, add a test case for the email.Utils.getaddresses() interface. --- diff --git a/Lib/email/Utils.py b/Lib/email/Utils.py index a2b6c8747e2f..99a65f9823a0 100644 --- a/Lib/email/Utils.py +++ b/Lib/email/Utils.py @@ -113,7 +113,7 @@ def getaddresses(fieldvalues): """Return a list of (REALNAME, EMAIL) for each fieldvalue.""" all = COMMASPACE.join(fieldvalues) a = _AddressList(all) - return a.getaddrlist() + return a.addresslist diff --git a/Lib/test/test_email.py b/Lib/test/test_email.py index c4b185a7533e..f0c8f1ac089d 100644 --- a/Lib/test/test_email.py +++ b/Lib/test/test_email.py @@ -1235,6 +1235,13 @@ class TestMiscellaneous(unittest.TestCase): eq(cset1, cset2) eq(cset2, cset1) + def test_getaddresses(self): + eq = self.assertEqual + eq(Utils.getaddresses(['aperson@dom.ain (Al Person)', + 'Bud Person ']), + [('Al Person', 'aperson@dom.ain'), + ('Bud Person', 'bperson@dom.ain')]) + # Test the iterator/generators