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

Method test_charset

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

Source from the content-addressed store, hash-verified

1827 self.assertFalse(self._msg.is_multipart())
1828
1829 def test_charset(self):
1830 eq = self.assertEqual
1831 msg = MIMEText('hello there', _charset='us-ascii')
1832 eq(msg.get_charset().input_charset, 'us-ascii')
1833 eq(msg['content-type'], 'text/plain; charset="us-ascii"')
1834 # Also accept a Charset instance
1835 charset = Charset('utf-8')
1836 charset.body_encoding = None
1837 msg = MIMEText('hello there', _charset=charset)
1838 eq(msg.get_charset().input_charset, 'utf-8')
1839 eq(msg['content-type'], 'text/plain; charset="utf-8"')
1840 eq(msg.get_payload(), 'hello there')
1841
1842 def test_7bit_input(self):
1843 eq = self.assertEqual

Callers

nothing calls this directly

Calls 5

MIMETextClass · 0.90
CharsetClass · 0.90
eqFunction · 0.85
get_charsetMethod · 0.80
get_payloadMethod · 0.80

Tested by

no test coverage detected