Back to index

python3.2  3.2.2
Public Member Functions
test.test_multibytecodec.Test_MultibyteCodec Class Reference

List of all members.

Public Member Functions

def test_nullcoding
def test_str_decode
def test_errorcallback_longindex
def test_codingspec
def test_init_segfault
def test_decode_unicode

Detailed Description

Definition at line 29 of file test_multibytecodec.py.


Member Function Documentation

Definition at line 48 of file test_multibytecodec.py.

00048 
00049     def test_codingspec(self):
00050         try:
00051             for enc in ALL_CJKENCODINGS:
00052                 code = '# coding: {}\n'.format(enc)
00053                 exec(code)
00054         finally:
00055             support.unlink(TESTFN)

Definition at line 63 of file test_multibytecodec.py.

00063 
00064     def test_decode_unicode(self):
00065         # Trying to decode an unicode string should raise a TypeError
00066         for enc in ALL_CJKENCODINGS:
00067             self.assertRaises(TypeError, codecs.getdecoder(enc), "")

Here is the call graph for this function:

Definition at line 41 of file test_multibytecodec.py.

00041 
00042     def test_errorcallback_longindex(self):
00043         dec = codecs.getdecoder('euc-kr')
00044         myreplace  = lambda exc: ('', sys.maxsize+1)
00045         codecs.register_error('test.cjktest', myreplace)
00046         self.assertRaises(IndexError, dec,
00047                           b'apple\x92ham\x93spam', 'test.cjktest')

Here is the call graph for this function:

Definition at line 56 of file test_multibytecodec.py.

00056 
00057     def test_init_segfault(self):
00058         # bug #3305: this used to segfault
00059         self.assertRaises(AttributeError,
00060                           _multibytecodec.MultibyteStreamReader, None)
00061         self.assertRaises(AttributeError,
00062                           _multibytecodec.MultibyteStreamWriter, None)

Here is the call graph for this function:

Definition at line 31 of file test_multibytecodec.py.

00031 
00032     def test_nullcoding(self):
00033         for enc in ALL_CJKENCODINGS:
00034             self.assertEqual(b''.decode(enc), '')
00035             self.assertEqual(str(b'', enc), '')
00036             self.assertEqual(''.encode(enc), b'')

Here is the call graph for this function:

Definition at line 37 of file test_multibytecodec.py.

00037 
00038     def test_str_decode(self):
00039         for enc in ALL_CJKENCODINGS:
00040             self.assertEqual('abcd'.encode(enc), b'abcd')

Here is the call graph for this function:


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