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

Method test_only_split_on_cr_lf

Lib/test/test_email/test_parser.py:38–68  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

36class TestParserBase:
37
38 def test_only_split_on_cr_lf(self):
39 # The unicode line splitter splits on unicode linebreaks, which are
40 # more numerous than allowed by the email RFCs; make sure we are only
41 # splitting on those two.
42 for parser in self.parsers:
43 with self.subTest(parser=parser.__name__):
44 msg = parser(
45 "Next-Line: not\x85broken\r\n"
46 "Null: not\x00broken\r\n"
47 "Vertical-Tab: not\vbroken\r\n"
48 "Form-Feed: not\fbroken\r\n"
49 "File-Separator: not\x1Cbroken\r\n"
50 "Group-Separator: not\x1Dbroken\r\n"
51 "Record-Separator: not\x1Ebroken\r\n"
52 "Line-Separator: not\u2028broken\r\n"
53 "Paragraph-Separator: not\u2029broken\r\n"
54 "\r\n",
55 policy=default,
56 )
57 self.assertEqual(msg.items(), [
58 ("Next-Line", "not\x85broken"),
59 ("Null", "not\x00broken"),
60 ("Vertical-Tab", "not\vbroken"),
61 ("Form-Feed", "not\fbroken"),
62 ("File-Separator", "not\x1Cbroken"),
63 ("Group-Separator", "not\x1Dbroken"),
64 ("Record-Separator", "not\x1Ebroken"),
65 ("Line-Separator", "not\u2028broken"),
66 ("Paragraph-Separator", "not\u2029broken"),
67 ])
68 self.assertEqual(msg.get_payload(), "")
69
70 class MyMessage(EmailMessage):
71 pass

Callers

nothing calls this directly

Calls 4

get_payloadMethod · 0.80
subTestMethod · 0.45
assertEqualMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected