=== modified file 'Lib/email/test/test_email.py' --- Lib/email/test/test_email.py 2010-09-28 21:49:36 +0000 +++ Lib/email/test/test_email.py 2010-10-01 05:37:57 +0000 @@ -2286,6 +2286,24 @@ # formataddr() quotes the name if there's a dot in it self.assertEqual(utils.formataddr((a, b)), y) + def test_parseaddr_with_escaped_quotes(self): + """Tests parsing email addresses which include escaped quotes (issue + 1050268). + + """ + eq = self.assertEqual + eq(('', '""example" example"@example.com'), + utils.parseaddr('""example" example"@example.com')) + eq(('', '""example" example"@example.com'), + utils.parseaddr('"\"example\" example"@example.com')) + eq(('', '"\"example\" example"@example.com'), + utils.parseaddr('"\\"example\\" example"@example.com')) + eq(('', '"\"example\" example"@example.com'), + utils.parseaddr('"\\\"example\\\" example"@example.com')) + eq(('', '"\\"example\\" example"@example.com'), + utils.parseaddr('"\\\\"example\\\\" example"@example.com')) + + def test_multiline_from_comment(self): x = """\ Foo