summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_rfc822.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2002-05-23 03:21:01 (GMT)
committerBarry Warsaw <barry@python.org>2002-05-23 03:21:01 (GMT)
commitf655328483b2e237cc2f71c1c308eceb2f30f6fd (patch)
tree3b81ed08b60d5262add766f3cdd2ce5d44a5c5c9 /Lib/test/test_rfc822.py
parent12424bc0eff82e0ebf5134cca1139b7d4b6faed0 (diff)
downloadcpython-f655328483b2e237cc2f71c1c308eceb2f30f6fd.zip
cpython-f655328483b2e237cc2f71c1c308eceb2f30f6fd.tar.gz
cpython-f655328483b2e237cc2f71c1c308eceb2f30f6fd.tar.bz2
parseaddr(): Fixed in the same way that Message.getaddrlist() was
fixed (re: SF bug #555035). Include a unittest.
Diffstat (limited to 'Lib/test/test_rfc822.py')
-rw-r--r--Lib/test/test_rfc822.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_rfc822.py b/Lib/test/test_rfc822.py
index dfce7c9..6add15b 100644
--- a/Lib/test/test_rfc822.py
+++ b/Lib/test/test_rfc822.py
@@ -213,6 +213,15 @@ A test message.
addrs.sort()
eq(addrs, ccs)
+ 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)