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

Method test_invalid_nonascii_header_as_string

Lib/test/test_mailbox.py:106–111  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

104 self._nonascii_msg.encode('latin-1'))
105
106 def test_invalid_nonascii_header_as_string(self):
107 subj = self._nonascii_msg.splitlines()[1]
108 key = self._box.add(subj.encode('latin-1'))
109 self.assertEqual(self._box.get_string(key),
110 'Subject: =?unknown-8bit?b?RmFsaW5hcHThciBo4Xpob3pzeuFsbO104XNz'
111 'YWwuIE3hciByZW5kZWx06Ww/?=\n\n')
112
113 def test_add_nonascii_string_header_raises(self):
114 with self.assertRaisesRegex(ValueError, "ASCII-only"):

Callers

nothing calls this directly

Calls 5

splitlinesMethod · 0.45
addMethod · 0.45
encodeMethod · 0.45
assertEqualMethod · 0.45
get_stringMethod · 0.45

Tested by

no test coverage detected