Back to index

python3.2  3.2.2
Public Member Functions
test.test_codecs.CodecsModuleTest Class Reference

List of all members.

Public Member Functions

def test_decode
def test_encode
def test_register
def test_lookup
def test_getencoder
def test_getdecoder
def test_getreader
def test_getwriter
def test_lookup_issue1813

Detailed Description

Definition at line 1192 of file test_codecs.py.


Member Function Documentation

Definition at line 1194 of file test_codecs.py.

01194 
01195     def test_decode(self):
01196         self.assertEqual(codecs.decode(b'\xe4\xf6\xfc', 'latin-1'),
01197                          '\xe4\xf6\xfc')
01198         self.assertRaises(TypeError, codecs.decode)
01199         self.assertEqual(codecs.decode(b'abc'), 'abc')
01200         self.assertRaises(UnicodeDecodeError, codecs.decode, b'\xff', 'ascii')

Here is the call graph for this function:

Definition at line 1201 of file test_codecs.py.

01201 
01202     def test_encode(self):
01203         self.assertEqual(codecs.encode('\xe4\xf6\xfc', 'latin-1'),
01204                          b'\xe4\xf6\xfc')
01205         self.assertRaises(TypeError, codecs.encode)
01206         self.assertRaises(LookupError, codecs.encode, "foo", "__spam__")
01207         self.assertEqual(codecs.encode('abc'), b'abc')
01208         self.assertRaises(UnicodeEncodeError, codecs.encode, '\xffff', 'ascii')

Here is the call graph for this function:

Definition at line 1222 of file test_codecs.py.

01222 
01223     def test_getdecoder(self):
01224         self.assertRaises(TypeError, codecs.getdecoder)
01225         self.assertRaises(LookupError, codecs.getdecoder, "__spam__")

Here is the call graph for this function:

Definition at line 1218 of file test_codecs.py.

01218 
01219     def test_getencoder(self):
01220         self.assertRaises(TypeError, codecs.getencoder)
01221         self.assertRaises(LookupError, codecs.getencoder, "__spam__")

Here is the call graph for this function:

Definition at line 1226 of file test_codecs.py.

01226 
01227     def test_getreader(self):
01228         self.assertRaises(TypeError, codecs.getreader)
01229         self.assertRaises(LookupError, codecs.getreader, "__spam__")

Here is the call graph for this function:

Definition at line 1230 of file test_codecs.py.

01230 
01231     def test_getwriter(self):
01232         self.assertRaises(TypeError, codecs.getwriter)
01233         self.assertRaises(LookupError, codecs.getwriter, "__spam__")

Here is the call graph for this function:

Definition at line 1213 of file test_codecs.py.

01213 
01214     def test_lookup(self):
01215         self.assertRaises(TypeError, codecs.lookup)
01216         self.assertRaises(LookupError, codecs.lookup, "__spam__")
01217         self.assertRaises(LookupError, codecs.lookup, " ")

Here is the call graph for this function:

Definition at line 1234 of file test_codecs.py.

01234 
01235     def test_lookup_issue1813(self):
01236         # Issue #1813: under Turkish locales, lookup of some codecs failed
01237         # because 'I' is lowercased as "ı" (dotless i)
01238         oldlocale = locale.setlocale(locale.LC_CTYPE)
01239         self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale)
01240         try:
01241             locale.setlocale(locale.LC_CTYPE, 'tr_TR')
01242         except locale.Error:
01243             # Unsupported locale on this system
01244             self.skipTest('test needs Turkish locale')
01245         c = codecs.lookup('ASCII')
01246         self.assertEqual(c.name, 'ascii')

Here is the call graph for this function:

Definition at line 1209 of file test_codecs.py.

01209 
01210     def test_register(self):
01211         self.assertRaises(TypeError, codecs.register)
01212         self.assertRaises(TypeError, codecs.register, 42)

Here is the call graph for this function:


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