Back to index

plone3  3.1.7
Functions
statusmessages.tests.test_encoding Namespace Reference

Functions

def test_encoding
def test_decoding
def test_suite

Detailed Description

Encoding tests.

Function Documentation

Definition at line 29 of file test_encoding.py.

00029 
00030 def test_decoding():
00031     r"""
00032     Test message decoding:
00033 
00034       >>> from Products.statusmessages.message import Message
00035       >>> from Products.statusmessages.message import decode
00036 
00037     Craft a wrong value:
00038 
00039       >>> m, rem = decode('\x01\x84spameggs')
00040       >>> m.message, m.type
00041       (u'spameggs', u'')
00042 
00043       >>> rem
00044       ''
00045 
00046     Craft another wrong value:
00047 
00048       >>> m, rem = decode('\x00\x24spameggs')
00049       >>> m.message, m.type
00050       (u's', u'pame')
00051 
00052       >>> rem
00053       'ggs'
00054 
00055     And another wrong value:
00056 
00057       >>> m, rem = decode('\x00spameggs')
00058       >>> m.message, m.type
00059       (u'pam', u'eggs')
00060 
00061       >>> rem
00062       ''
00063 
00064     And yet another wrong value:
00065 
00066       >>> m, rem = decode('')
00067       >>> m is None, rem is ''
00068       (True, True)
00069     """
00070 

Definition at line 7 of file test_encoding.py.

00007 
00008 def test_encoding():
00009     r"""
00010     Test message encoding:
00011 
00012       >>> from Products.statusmessages.message import Message
00013       >>> from Products.statusmessages.message import decode
00014 
00015       >>> m = Message(u'spam', u'eggs')
00016       >>> m.encode()
00017       '\x00\x84spameggs'
00018 
00019       >>> decode(m.encode())[0] == m
00020       True
00021 
00022       >>> m = Message(u'spam')
00023       >>> m.encode()
00024       '\x00\x80spam'
00025 
00026       >>> decode(m.encode())[0] == m
00027       True
00028     """

Definition at line 71 of file test_encoding.py.

00071 
00072 def test_suite():
00073     from Testing.ZopeTestCase import ZopeDocTestSuite
00074     return ZopeDocTestSuite()

Here is the call graph for this function: