Back to index

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

List of all members.

Public Member Functions

def test_len
def test_decode
def test_encode
def test_header_encode

Detailed Description

Definition at line 3467 of file test_email.py.


Member Function Documentation

Definition at line 3481 of file test_email.py.

03481 
03482     def test_decode(self):
03483         eq = self.assertEqual
03484         eq(base64mime.decode(''), b'')
03485         eq(base64mime.decode('aGVsbG8='), b'hello')

Here is the call graph for this function:

Definition at line 3486 of file test_email.py.

03486 
03487     def test_encode(self):
03488         eq = self.assertEqual
03489         eq(base64mime.body_encode(b''), b'')
03490         eq(base64mime.body_encode(b'hello'), 'aGVsbG8=\n')
03491         # Test the binary flag
03492         eq(base64mime.body_encode(b'hello\n'), 'aGVsbG8K\n')
03493         # Test the maxlinelen arg
03494         eq(base64mime.body_encode(b'xxxx ' * 20, maxlinelen=40), """\
03495 eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg
03496 eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg
03497 eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg
03498 eHh4eCB4eHh4IA==
03499 """)
03500         # Test the eol argument
03501         eq(base64mime.body_encode(b'xxxx ' * 20, maxlinelen=40, eol='\r\n'),
03502            """\
03503 eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg\r
03504 eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg\r
03505 eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg\r
03506 eHh4eCB4eHh4IA==\r
03507 """)

Here is the call graph for this function:

Definition at line 3508 of file test_email.py.

03508 
03509     def test_header_encode(self):
03510         eq = self.assertEqual
03511         he = base64mime.header_encode
03512         eq(he('hello'), '=?iso-8859-1?b?aGVsbG8=?=')
03513         eq(he('hello\r\nworld'), '=?iso-8859-1?b?aGVsbG8NCndvcmxk?=')
03514         eq(he('hello\nworld'), '=?iso-8859-1?b?aGVsbG8Kd29ybGQ=?=')
03515         # Test the charset option
03516         eq(he('hello', charset='iso-8859-2'), '=?iso-8859-2?b?aGVsbG8=?=')
03517         eq(he('hello\nworld'), '=?iso-8859-1?b?aGVsbG8Kd29ybGQ=?=')
03518 
03519 

Here is the call graph for this function:

Definition at line 3468 of file test_email.py.

03468 
03469     def test_len(self):
03470         eq = self.assertEqual
03471         eq(base64mime.header_length('hello'),
03472            len(base64mime.body_encode(b'hello', eol='')))
03473         for size in range(15):
03474             if   size == 0 : bsize = 0
03475             elif size <= 3 : bsize = 4
03476             elif size <= 6 : bsize = 8
03477             elif size <= 9 : bsize = 12
03478             elif size <= 12: bsize = 16
03479             else           : bsize = 20
03480             eq(base64mime.header_length('x' * size), bsize)

Here is the call graph for this function:


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