mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Merge #11584: Since __getitem__ returns headers, make decode_header handle them.
This commit is contained in:
commit
961355a56a
2 changed files with 20 additions and 0 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue