summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_email
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2016-09-11 21:22:56 (GMT)
committerR David Murray <rdmurray@bitdance.com>2016-09-11 21:22:56 (GMT)
commit0e0cfd71355accafd009916472ebb4d4fe0ab4ec (patch)
treee34ff0e84d0a10b03d4a115b049bf974b99d7936 /Lib/test/test_email
parente4946e73c88ef5381382788800e9a287daaaf7dc (diff)
downloadcpython-0e0cfd71355accafd009916472ebb4d4fe0ab4ec.zip
cpython-0e0cfd71355accafd009916472ebb4d4fe0ab4ec.tar.gz
cpython-0e0cfd71355accafd009916472ebb4d4fe0ab4ec.tar.bz2
#19003: Only replace \r and/or \n line endings in email.generator.
This is a further restoration of backward compatibility, as well as being correct per the RFCs.
Diffstat (limited to 'Lib/test/test_email')
-rw-r--r--Lib/test/test_email/test_email.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py
index 1d50feb..a53cc9b 100644
--- a/Lib/test/test_email/test_email.py
+++ b/Lib/test/test_email/test_email.py
@@ -1598,6 +1598,18 @@ class TestMIMEApplication(unittest.TestCase):
self.assertEqual(msg.get_payload(), '\uFFFD' * len(bytesdata))
self.assertEqual(msg2.get_payload(decode=True), bytesdata)
+ def test_binary_body_with_unicode_linend_encode_noop(self):
+ # Issue 19003: This is a variation on #16564.
+ bytesdata = b'\x0b\xfa\xfb\xfc\xfd\xfe\xff'
+ msg = MIMEApplication(bytesdata, _encoder=encoders.encode_noop)
+ self.assertEqual(msg.get_payload(decode=True), bytesdata)
+ s = BytesIO()
+ g = BytesGenerator(s)
+ g.flatten(msg)
+ wireform = s.getvalue()
+ msg2 = email.message_from_bytes(wireform)
+ self.assertEqual(msg2.get_payload(decode=True), bytesdata)
+
def test_binary_body_with_encode_quopri(self):
# Issue 14360.
bytesdata = b'\xfa\xfb\xfc\xfd\xfe\xff '