mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
#11558: Better message if attach called on non-multipart.
Original patch by Varun Sharma.
This commit is contained in:
parent
733e50ad9e
commit
5dda12491e
4 changed files with 18 additions and 1 deletions
|
|
@ -124,6 +124,14 @@ class TestMessageAPI(TestEmailBase):
|
|||
msg.set_payload([])
|
||||
self.assertEqual(msg.get_payload(), [])
|
||||
|
||||
def test_attach_when_payload_is_string(self):
|
||||
msg = Message()
|
||||
msg['Content-Type'] = 'multipart/mixed'
|
||||
msg.set_payload('string payload')
|
||||
sub_msg = MIMEMessage(Message())
|
||||
self.assertRaisesRegex(TypeError, "[Aa]ttach.*non-multipart",
|
||||
msg.attach, sub_msg)
|
||||
|
||||
def test_get_charsets(self):
|
||||
eq = self.assertEqual
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue