summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_email
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2011-03-25 19:31:52 (GMT)
committerR David Murray <rdmurray@bitdance.com>2011-03-25 19:31:52 (GMT)
commit961355a56a7a896c7ea4ad7416f0cf74a50852a9 (patch)
treeaf6101ff06aa416d88f8bf1816104cccd45598c8 /Lib/test/test_email
parentfd2c2a5271a00795372e9dae22a4c20d8d0807cf (diff)
parent041015cc70465c8a008d4ef45ffe3fe05041fad2 (diff)
downloadcpython-961355a56a7a896c7ea4ad7416f0cf74a50852a9.zip
cpython-961355a56a7a896c7ea4ad7416f0cf74a50852a9.tar.gz
cpython-961355a56a7a896c7ea4ad7416f0cf74a50852a9.tar.bz2
Merge #11584: Since __getitem__ returns headers, make decode_header handle them.
Diffstat (limited to 'Lib/test/test_email')
-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()