diff options
author | Walter Dörwald <walter@livinglogic.de> | 2004-10-28 13:04:26 (GMT) |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2004-10-28 13:04:26 (GMT) |
commit | 063e1e846dc5c3fe593cef5b14cc429369dcd2c2 (patch) | |
tree | 53665490f58752b6555f0bdd6256bf23219930d1 | |
parent | 14adbe77b5e9c68fb525d25961c86b5b0dbb1945 (diff) | |
download | cpython-063e1e846dc5c3fe593cef5b14cc429369dcd2c2.zip cpython-063e1e846dc5c3fe593cef5b14cc429369dcd2c2.tar.gz cpython-063e1e846dc5c3fe593cef5b14cc429369dcd2c2.tar.bz2 |
Trigger a few error cases in Modules/_codecsmodule.c.
-rw-r--r-- | Lib/test/test_codecs.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py index 54d9da5..21ae467 100644 --- a/Lib/test/test_codecs.py +++ b/Lib/test/test_codecs.py @@ -454,9 +454,23 @@ class CodecsModuleTest(unittest.TestCase): 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): |