#11019: Make BytesGenerator handle Message with None body.

Bug discovery and initial patch by Victor Stinner.
This commit is contained in:
R. David Murray 2011-01-26 21:21:32 +00:00
parent a63a312a3f
commit 7372a07fd0
3 changed files with 12 additions and 0 deletions

View file

@ -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?=