MCPcopy Create free account
hub / github.com/python/cpython / test_no_nl_preamble

Method test_no_nl_preamble

Lib/test/test_email/test_email.py:2658–2691  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2656 eq(sfp.getvalue(), text)
2657
2658 def test_no_nl_preamble(self):
2659 eq = self.ndiffAssertEqual
2660 msg = Message()
2661 msg['From'] = 'aperson@dom.ain'
2662 msg['To'] = 'bperson@dom.ain'
2663 msg['Subject'] = 'Test'
2664 msg.preamble = 'MIME message'
2665 msg.epilogue = ''
2666 msg1 = MIMEText('One')
2667 msg2 = MIMEText('Two')
2668 msg.add_header('Content-Type', 'multipart/mixed', boundary='BOUNDARY')
2669 msg.attach(msg1)
2670 msg.attach(msg2)
2671 eq(msg.as_string(), """\
2672From: aperson@dom.ain
2673To: bperson@dom.ain
2674Subject: Test
2675Content-Type: multipart/mixed; boundary="BOUNDARY"
2676
2677MIME message
2678--BOUNDARY
2679Content-Type: text/plain; charset="us-ascii"
2680MIME-Version: 1.0
2681Content-Transfer-Encoding: 7bit
2682
2683One
2684--BOUNDARY
2685Content-Type: text/plain; charset="us-ascii"
2686MIME-Version: 1.0
2687Content-Transfer-Encoding: 7bit
2688
2689Two
2690--BOUNDARY--
2691""")
2692
2693 def test_default_type(self):
2694 eq = self.assertEqual

Callers

nothing calls this directly

Calls 6

add_headerMethod · 0.95
attachMethod · 0.95
as_stringMethod · 0.95
MessageClass · 0.90
MIMETextClass · 0.90
eqFunction · 0.85

Tested by

no test coverage detected