summaryrefslogtreecommitdiffstats
path: root/Lib/email/test/test_email.py
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2011-01-26 21:21:32 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2011-01-26 21:21:32 (GMT)
commit7372a07fd0eb8e32fe9d03ee5a56ecc14788dfb0 (patch)
tree73992b4a0b679dcc803f4136056c60980fe3dd91 /Lib/email/test/test_email.py
parenta63a312a3f5a4f3b76617831e56ac9d295929fa0 (diff)
downloadcpython-7372a07fd0eb8e32fe9d03ee5a56ecc14788dfb0.zip
cpython-7372a07fd0eb8e32fe9d03ee5a56ecc14788dfb0.tar.gz
cpython-7372a07fd0eb8e32fe9d03ee5a56ecc14788dfb0.tar.bz2
#11019: Make BytesGenerator handle Message with None body.
Bug discovery and initial patch by Victor Stinner.
Diffstat (limited to 'Lib/email/test/test_email.py')
-rw-r--r--Lib/email/test/test_email.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py
index e4083ad..16772b1 100644
--- a/Lib/email/test/test_email.py
+++ b/Lib/email/test/test_email.py
@@ -2989,6 +2989,13 @@ class Test8BitBytesHandling(unittest.TestCase):
email.generator.BytesGenerator(out).flatten(msg)
self.assertEqual(out.getvalue(), self.non_latin_bin_msg)
+ def test_bytes_generator_handles_None_body(self):
+ #Issue 11019
+ msg = email.message.Message()
+ out = BytesIO()
+ email.generator.BytesGenerator(out).flatten(msg)
+ self.assertEqual(out.getvalue(), b"\n")
+
non_latin_bin_msg_as7bit_wrapped = textwrap.dedent("""\
From: foo@bar.com
To: =?unknown-8bit?q?b=C3=A1z?=