]> granicus.if.org Git - python/commitdiff
test_escape_backslashes(): A test for SF bug #663369 by Matthew Woodcraft.
authorBarry Warsaw <barry@python.org>
Mon, 10 Mar 2003 19:18:34 +0000 (19:18 +0000)
committerBarry Warsaw <barry@python.org>
Mon, 10 Mar 2003 19:18:34 +0000 (19:18 +0000)
Lib/email/test/test_email.py

index 3c382cb29216325a41b3a014425050b6e019e237..317e08a847aeb0d9dff92a538838504b137ff8be 100644 (file)
@@ -1859,6 +1859,14 @@ class TestMiscellaneous(unittest.TestCase):
         b = 'person@dom.ain'
         self.assertEqual(Utils.parseaddr(Utils.formataddr((a, b))), (a, b))
 
+    def test_escape_backslashes(self):
+        self.assertEqual(
+            Utils.formataddr(('Arthur \Backslash\ Foobar', 'person@dom.ain')),
+            r'"Arthur \\Backslash\\ Foobar" <person@dom.ain>')
+        a = r'Arthur \Backslash\ Foobar'
+        b = 'person@dom.ain'
+        self.assertEqual(Utils.parseaddr(Utils.formataddr((a, b))), (a, b))
+
     def test_name_with_dot(self):
         x = 'John X. Doe <jxd@example.com>'
         y = '"John X. Doe" <jxd@example.com>'