cpython: 45cc298d40eb (original) (raw)

Mercurial > cpython

changeset 68875:45cc298d40eb 3.1

#11590: fix quoprimime decode handling of empty strings and line endings. [#11590]

R David Murray rdmurray@bitdance.com
date Wed, 23 Mar 2011 15:25:55 -0400
parents 3dbea3fa73fb
children df613f7b726a e53097288c8c
files Lib/email/quoprimime.py Lib/email/test/test_email.py
diffstat 2 files changed, 18 insertions(+), 3 deletions(-)[+] [-] Lib/email/quoprimime.py 6 Lib/email/test/test_email.py 15

line wrap: on

line diff

--- a/Lib/email/quoprimime.py +++ b/Lib/email/quoprimime.py @@ -135,9 +135,9 @@ def header_encode(header_bytes, charset= charset names the character set to use in the RFC 2046 header. It defaults to iso-8859-1. """

--- a/Lib/email/test/test_email.py +++ b/Lib/email/test/test_email.py @@ -2890,6 +2890,9 @@ class TestQuopri(unittest.TestCase): encoded_header = quoprimime.header_encode(header, charset) self.assertEqual(encoded_header, expected_encoded_header)

+ def test_header_encode_one_word(self): self._test_header_encode(b'hello', '=?iso-8859-1?q?hello?=') @@ -2946,6 +2949,15 @@ class TestQuopri(unittest.TestCase): def test_decode_one_line_lf(self): self._test_decode('hello\n', 'hello\n')

+

+

+ def test_decode_one_line_one_word(self): self._test_decode('hello\r\nworld', 'hello\nworld') @@ -2955,6 +2967,9 @@ class TestQuopri(unittest.TestCase): def test_decode_two_lines(self): self._test_decode('hello\r\nworld\r\n', 'hello\nworld\n')

+ def test_decode_one_long_line(self): self._test_decode('Spam' * 250, 'Spam' * 250)