summaryrefslogtreecommitdiffstats
path: root/Lib/email/test
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2011-03-23 19:25:55 (GMT)
committerR David Murray <rdmurray@bitdance.com>2011-03-23 19:25:55 (GMT)
commitcafd79d904d19e90af375dbee43668f7dbf733d0 (patch)
tree68b1da59f56382ff622bf028c93595224a9e4337 /Lib/email/test
parentec1b5b88ee31ba64d80f7d2e4af721718e450499 (diff)
downloadcpython-cafd79d904d19e90af375dbee43668f7dbf733d0.zip
cpython-cafd79d904d19e90af375dbee43668f7dbf733d0.tar.gz
cpython-cafd79d904d19e90af375dbee43668f7dbf733d0.tar.bz2
#11590: fix quoprimime decode handling of empty strings and line endings.
Diffstat (limited to 'Lib/email/test')
-rw-r--r--Lib/email/test/test_email.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py
index f9a499f..cb3b0b3 100644
--- 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_null(self):
+ self._test_header_encode(b'', '')
+
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_cr(self):
+ self._test_decode('hello\r', 'hello\n')
+
+ def test_decode_one_line_nl(self):
+ self._test_decode('hello\n', 'helloX', eol='X')
+
+ def test_decode_one_line_crnl(self):
+ self._test_decode('hello\r\n', 'helloX', eol='X')
+
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_two_lines_eol(self):
+ self._test_decode('hello\r\nworld\r\n', 'helloXworldX', eol='X')
+
def test_decode_one_long_line(self):
self._test_decode('Spam' * 250, 'Spam' * 250)