MCPcopy Index your code
hub / github.com/python/cpython / test_bytes_header_parser

Method test_bytes_header_parser

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

Source from the content-addressed store, hash-verified

3920 self.assertIsInstance(msg.get_payload(), str)
3921
3922 def test_bytes_header_parser(self):
3923 eq = self.assertEqual
3924 # Parse only the headers of a complex multipart MIME document
3925 with openfile('msg_02.txt', 'rb') as fp:
3926 msg = email.parser.BytesHeaderParser().parse(fp)
3927 eq(msg['from'], 'ppp-request@zzz.org')
3928 eq(msg['to'], 'ppp@zzz.org')
3929 eq(msg.get_content_type(), 'multipart/mixed')
3930 self.assertFalse(msg.is_multipart())
3931 self.assertIsInstance(msg.get_payload(), str)
3932 self.assertIsInstance(msg.get_payload(decode=True), bytes)
3933
3934 def test_header_parser_multipart_is_valid(self):
3935 # Don't flag valid multipart emails as having defects

Callers

nothing calls this directly

Calls 8

openfileFunction · 0.90
eqFunction · 0.85
get_content_typeMethod · 0.80
assertFalseMethod · 0.80
is_multipartMethod · 0.80
assertIsInstanceMethod · 0.80
get_payloadMethod · 0.80
parseMethod · 0.45

Tested by

no test coverage detected