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

Method test_header_splitter

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

Source from the content-addressed store, hash-verified

1093 self.assertEqual(h.encode(), res)
1094
1095 def test_header_splitter(self):
1096 eq = self.ndiffAssertEqual
1097 msg = MIMEText('')
1098 # It'd be great if we could use add_header() here, but that doesn't
1099 # guarantee an order of the parameters.
1100 msg['X-Foobar-Spoink-Defrobnit'] = (
1101 'wasnipoop; giraffes="very-long-necked-animals"; '
1102 'spooge="yummy"; hippos="gargantuan"; marshmallows="gooey"')
1103 sfp = StringIO()
1104 g = Generator(sfp)
1105 g.flatten(msg)
1106 eq(sfp.getvalue(), '''\
1107Content-Type: text/plain; charset="us-ascii"
1108MIME-Version: 1.0
1109Content-Transfer-Encoding: 7bit
1110X-Foobar-Spoink-Defrobnit: wasnipoop; giraffes="very-long-necked-animals";
1111 spooge="yummy"; hippos="gargantuan"; marshmallows="gooey"
1112
1113''')
1114
1115 def test_no_semis_header_splitter(self):
1116 eq = self.ndiffAssertEqual

Callers

nothing calls this directly

Calls 6

flattenMethod · 0.95
getvalueMethod · 0.95
MIMETextClass · 0.90
StringIOClass · 0.90
GeneratorClass · 0.90
eqFunction · 0.85

Tested by

no test coverage detected