summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_email/test_email.py
diff options
context:
space:
mode:
authorguido@google.com <guido@google.com>2011-03-29 19:09:45 (GMT)
committerguido@google.com <guido@google.com>2011-03-29 19:09:45 (GMT)
commit69cfcabae3d72845d44e1078d25072fdbb02072c (patch)
tree0aedaa424e8c8f7139567aed7b6980ea59e16c97 /Lib/test/test_email/test_email.py
parent2008a8f8c09b18fbd24e8039553d50a828dd3fb2 (diff)
parente6c1eb92675f67d1907bd7ba00c44262c18e93d4 (diff)
downloadcpython-69cfcabae3d72845d44e1078d25072fdbb02072c.zip
cpython-69cfcabae3d72845d44e1078d25072fdbb02072c.tar.gz
cpython-69cfcabae3d72845d44e1078d25072fdbb02072c.tar.bz2
Merge.
Diffstat (limited to 'Lib/test/test_email/test_email.py')
-rw-r--r--Lib/test/test_email/test_email.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py
index ec9421d..6cefa38 100644
--- a/Lib/test/test_email/test_email.py
+++ b/Lib/test/test_email/test_email.py
@@ -3925,6 +3925,20 @@ A very long line that must get split to something other than at the
h.append(x, errors='replace')
eq(str(h), e)
+ def test_escaped_8bit_header(self):
+ x = b'Ynwp4dUEbay Auction Semiar- No Charge \x96 Earn Big'
+ x = x.decode('ascii', 'surrogateescape')
+ h = Header(x, charset=email.charset.UNKNOWN8BIT)
+ self.assertEqual(str(h),
+ 'Ynwp4dUEbay Auction Semiar- No Charge \uFFFD Earn Big')
+ self.assertEqual(email.header.decode_header(h), [(x, 'unknown-8bit')])
+
+ def test_modify_returned_list_does_not_change_header(self):
+ h = Header('test')
+ chunks = email.header.decode_header(h)
+ chunks.append(('ascii', 'test2'))
+ self.assertEqual(str(h), 'test')
+
def test_encoded_adjacent_nonencoded(self):
eq = self.assertEqual
h = Header()