[Python-checkins] python/dist/src/Lib/test test_codecs.py, 1.14, 1.15

doerwalter at users.sourceforge.net doerwalter at users.sourceforge.net
Thu Oct 28 15:04:30 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3004/Lib/test

Modified Files:
	test_codecs.py 
Log Message:
Trigger a few error cases in Modules/_codecsmodule.c.


Index: test_codecs.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codecs.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- test_codecs.py	17 Oct 2004 23:51:21 -0000	1.14
+++ test_codecs.py	28 Oct 2004 13:04:26 -0000	1.15
@@ -454,9 +454,23 @@
     def test_decode(self):
         self.assertEquals(codecs.decode('\xe4\xf6\xfc', 'latin-1'),
                           u'\xe4\xf6\xfc')
+        self.assertRaises(TypeError, codecs.decode)
+        self.assertEquals(codecs.decode('abc'), u'abc')
+        self.assertRaises(UnicodeDecodeError, codecs.decode, '\xff', 'ascii')
+
     def test_encode(self):
         self.assertEquals(codecs.encode(u'\xe4\xf6\xfc', 'latin-1'),
                           '\xe4\xf6\xfc')
+        self.assertRaises(TypeError, codecs.encode)
+        self.assertEquals(codecs.encode(u'abc'), 'abc')
+        self.assertRaises(UnicodeEncodeError, codecs.encode, u'\xffff', 'ascii')
+
+    def test_register(self):
+        self.assertRaises(TypeError, codecs.register)
+
+    def test_lookup(self):
+        self.assertRaises(TypeError, codecs.lookup)
+        self.assertRaises(LookupError, codecs.lookup, "__spam__")
 
 class StreamReaderTest(unittest.TestCase):
 



More information about the Python-checkins mailing list