]> granicus.if.org Git - python/commitdiff
getaddresses(): Like the change in rfc822.py, this one needs to access
authorBarry Warsaw <barry@python.org>
Wed, 22 May 2002 01:52:10 +0000 (01:52 +0000)
committerBarry Warsaw <barry@python.org>
Wed, 22 May 2002 01:52:10 +0000 (01:52 +0000)
the AddressList.addresslist attribute directly.

Also, add a test case for the email.Utils.getaddresses() interface.

Lib/email/Utils.py
Lib/test/test_email.py

index a2b6c8747e2ff2d22f3215e1f51c36e6e8c55d51..99a65f9823a0be0753a2cd44d54bf96aa455c3a3 100644 (file)
@@ -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
 
 
 \f
index c4b185a7533e0fb4e361459eacd157d592583f08..f0c8f1ac089d48bb725dbb960ff58b1477f4853b 100644 (file)
@@ -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 <bperson@dom.ain>']),
+           [('Al Person', 'aperson@dom.ain'),
+            ('Bud Person', 'bperson@dom.ain')])
+
 
 \f
 # Test the iterator/generators