MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_getset_charset

Method test_getset_charset

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

Source from the content-addressed store, hash-verified

62 eq(msg.get_all('xx', 'n/a'), 'n/a')
63
64 def test_getset_charset(self):
65 eq = self.assertEqual
66 msg = Message()
67 eq(msg.get_charset(), None)
68 charset = Charset('iso-8859-1')
69 msg.set_charset(charset)
70 eq(msg['mime-version'], '1.0')
71 eq(msg.get_content_type(), 'text/plain')
72 eq(msg['content-type'], 'text/plain; charset="iso-8859-1"')
73 eq(msg.get_param('charset'), 'iso-8859-1')
74 eq(msg['content-transfer-encoding'], 'quoted-printable')
75 eq(msg.get_charset().input_charset, 'iso-8859-1')
76 # Remove the charset
77 msg.set_charset(None)
78 eq(msg.get_charset(), None)
79 eq(msg['content-type'], 'text/plain')
80 # Try adding a charset when there's already MIME headers present
81 msg = Message()
82 msg['MIME-Version'] = '2.0'
83 msg['Content-Type'] = 'text/x-weird'
84 msg['Content-Transfer-Encoding'] = 'quinted-puntable'
85 msg.set_charset(charset)
86 eq(msg['mime-version'], '2.0')
87 eq(msg['content-type'], 'text/x-weird; charset="iso-8859-1"')
88 eq(msg['content-transfer-encoding'], 'quinted-puntable')
89
90 def test_set_charset_from_string(self):
91 eq = self.assertEqual

Callers

nothing calls this directly

Calls 7

get_charsetMethod · 0.95
set_charsetMethod · 0.95
get_content_typeMethod · 0.95
get_paramMethod · 0.95
MessageClass · 0.90
CharsetClass · 0.90
eqFunction · 0.50

Tested by

no test coverage detected