mirror of
https://github.com/python/cpython
synced 2024-09-15 23:57:10 +00:00
bpo-19460: Add test for MIMENonMultipart (GH-29817)
This commit is contained in:
parent
4dfae6f38e
commit
46c8d91571
|
@ -2743,6 +2743,20 @@ def test_multipart_custom_policy(self):
|
|||
self.assertEqual(str(cm.exception),
|
||||
'There may be at most 1 To headers in a message')
|
||||
|
||||
|
||||
# Test the NonMultipart class
|
||||
class TestNonMultipart(TestEmailBase):
|
||||
def test_nonmultipart_is_not_multipart(self):
|
||||
msg = MIMENonMultipart('text', 'plain')
|
||||
self.assertFalse(msg.is_multipart())
|
||||
|
||||
def test_attach_raises_exception(self):
|
||||
msg = Message()
|
||||
msg['Subject'] = 'subpart 1'
|
||||
r = MIMENonMultipart('text', 'plain')
|
||||
self.assertRaises(errors.MultipartConversionError, r.attach, msg)
|
||||
|
||||
|
||||
# A general test of parser->model->generator idempotency. IOW, read a message
|
||||
# in, parse it into a message object tree, then without touching the tree,
|
||||
# regenerate the plain text. The original text and the transformed text
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Add new Test for ``Lib/email/mime/nonmultipart.py::MIMENonMultipart``.
|
Loading…
Reference in a new issue