Back to index

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

List of all members.

Public Member Functions

def test_EncodersEncode_base64
def test_encode_empty_payload
def test_default_cte
def test_encode7or8bit

Detailed Description

Definition at line 623 of file test_email.py.


Member Function Documentation

Definition at line 640 of file test_email.py.

00640 
00641     def test_default_cte(self):
00642         eq = self.assertEqual
00643         # 7bit data and the default us-ascii _charset
00644         msg = MIMEText('hello world')
00645         eq(msg['content-transfer-encoding'], '7bit')
00646         # Similar, but with 8bit data
00647         msg = MIMEText('hello \xf8 world')
00648         eq(msg['content-transfer-encoding'], '8bit')
00649         # And now with a different charset
00650         msg = MIMEText('hello \xf8 world', _charset='iso-8859-1')
00651         eq(msg['content-transfer-encoding'], 'quoted-printable')

Here is the call graph for this function:

Definition at line 652 of file test_email.py.

00652 
00653     def test_encode7or8bit(self):
00654         # Make sure a charset whose input character set is 8bit but
00655         # whose output character set is 7bit gets a transfer-encoding
00656         # of 7bit.
00657         eq = self.assertEqual
00658         msg = MIMEText('文', _charset='euc-jp')
00659         eq(msg['content-transfer-encoding'], '7bit')
00660 
00661 
# Test long header wrapping

Here is the call graph for this function:

Definition at line 634 of file test_email.py.

00634 
00635     def test_encode_empty_payload(self):
00636         eq = self.assertEqual
00637         msg = Message()
00638         msg.set_charset('us-ascii')
00639         eq(msg['content-transfer-encoding'], '7bit')

Here is the call graph for this function:

Definition at line 625 of file test_email.py.

00625 
00626     def test_EncodersEncode_base64(self):
00627         with openfile('PyBanner048.gif', 'rb') as fp:
00628             bindata = fp.read()
00629         mimed = email.mime.image.MIMEImage(bindata)
00630         base64ed = mimed.get_payload()
00631         # the transfer-encoded body lines should all be <=76 characters
00632         lines = base64ed.split('\n')
00633         self.assertLessEqual(max([ len(x) for x in lines ]), 76)

Here is the call graph for this function:


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