Back to index

python3.2  3.2.2
Public Member Functions
email.test.test_email.TestCharset Class Reference

List of all members.

Public Member Functions

def tearDown
def test_codec_encodeable
def test_body_encode

Detailed Description

Definition at line 3836 of file test_email.py.


Member Function Documentation

Definition at line 3837 of file test_email.py.

03837 
03838     def tearDown(self):
03839         from email import charset as CharsetModule
03840         try:
03841             del CharsetModule.CHARSETS['fake']
03842         except KeyError:
03843             pass

Here is the caller graph for this function:

Definition at line 3855 of file test_email.py.

03855 
03856     def test_body_encode(self):
03857         eq = self.assertEqual
03858         # Try a charset with QP body encoding
03859         c = Charset('iso-8859-1')
03860         eq('hello w=F6rld', c.body_encode('hello w\xf6rld'))
03861         # Try a charset with Base64 body encoding
03862         c = Charset('utf-8')
03863         eq('aGVsbG8gd29ybGQ=\n', c.body_encode(b'hello world'))
03864         # Try a charset with None body encoding
03865         c = Charset('us-ascii')
03866         eq('hello world', c.body_encode('hello world'))
03867         # Try the convert argument, where input codec != output codec
03868         c = Charset('euc-jp')
03869         # With apologies to Tokio Kikuchi ;)
        # XXX FIXME

Here is the call graph for this function:

Definition at line 3844 of file test_email.py.

03844 
03845     def test_codec_encodeable(self):
03846         eq = self.assertEqual
03847         # Make sure us-ascii = no Unicode conversion
03848         c = Charset('us-ascii')
03849         eq(c.header_encode('Hello World!'), 'Hello World!')
03850         # Test 8-bit idempotency with us-ascii
03851         s = '\xa4\xa2\xa4\xa4\xa4\xa6\xa4\xa8\xa4\xaa'
03852         self.assertRaises(UnicodeError, c.header_encode, s)
03853         c = Charset('utf-8')
03854         eq(c.header_encode(s), '=?utf-8?b?wqTCosKkwqTCpMKmwqTCqMKkwqo=?=')

Here is the call graph for this function:


The documentation for this class was generated from the following file: