summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_email/test_contentmanager.py
diff options
context:
space:
mode:
authorJohannes Reiff <mail@jreiff.de>2021-08-09 16:45:41 (GMT)
committerGitHub <noreply@github.com>2021-08-09 16:45:41 (GMT)
commitb33186bc43bb5aaf652dd9d093a08fdde796d499 (patch)
tree5fa5ff110600d1a6f5fd5e4e68ffd72d3a059f00 /Lib/test/test_email/test_contentmanager.py
parentd0978761118856e8ca8ea7b162a6585b8da83df9 (diff)
downloadcpython-b33186bc43bb5aaf652dd9d093a08fdde796d499.zip
cpython-b33186bc43bb5aaf652dd9d093a08fdde796d499.tar.gz
cpython-b33186bc43bb5aaf652dd9d093a08fdde796d499.tar.bz2
bpo-41402: Fix email ContentManager calling .encode() on bytes (GH-21631)
Diffstat (limited to 'Lib/test/test_email/test_contentmanager.py')
-rw-r--r--Lib/test/test_email/test_contentmanager.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_email/test_contentmanager.py b/Lib/test/test_email/test_contentmanager.py
index f4f6bb7..694cef4 100644
--- a/Lib/test/test_email/test_contentmanager.py
+++ b/Lib/test/test_email/test_contentmanager.py
@@ -776,6 +776,18 @@ class TestRawDataManager(TestEmailBase):
foo
""").encode('ascii'))
+ def test_set_content_bytes_cte_7bit(self):
+ m = self._make_message()
+ m.set_content(b'ASCII-only message.\n',
+ maintype='application', subtype='octet-stream', cte='7bit')
+ self.assertEqual(str(m), textwrap.dedent("""\
+ Content-Type: application/octet-stream
+ Content-Transfer-Encoding: 7bit
+ MIME-Version: 1.0
+
+ ASCII-only message.
+ """))
+
content_object_params = {
'text_plain': ('content', ()),
'text_html': ('content', ('html',)),