diff options
author | Walter Dörwald <walter@livinglogic.de> | 2005-11-17 18:51:34 (GMT) |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2005-11-17 18:51:34 (GMT) |
commit | 690402ff170abfc9b24269aa7db923eddf60e607 (patch) | |
tree | de6e027bd7e7d55a353e6a47b44f4249d2e62c86 /Lib/test/test_codecs.py | |
parent | a53899272b71d90a2a2ade76532ff0b96d7ceed1 (diff) | |
download | cpython-690402ff170abfc9b24269aa7db923eddf60e607.zip cpython-690402ff170abfc9b24269aa7db923eddf60e607.tar.gz cpython-690402ff170abfc9b24269aa7db923eddf60e607.tar.bz2 |
Add tests to increase code coverage in Python/codecs.c and Python/exceptions.c.
Diffstat (limited to 'Lib/test/test_codecs.py')
-rw-r--r-- | Lib/test/test_codecs.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py index 336696c..b344f9a 100644 --- a/Lib/test/test_codecs.py +++ b/Lib/test/test_codecs.py @@ -746,15 +746,34 @@ class CodecsModuleTest(unittest.TestCase): self.assertEquals(codecs.encode(u'\xe4\xf6\xfc', 'latin-1'), '\xe4\xf6\xfc') self.assertRaises(TypeError, codecs.encode) + self.assertRaises(LookupError, codecs.encode, "foo", "__spam__") self.assertEquals(codecs.encode(u'abc'), 'abc') self.assertRaises(UnicodeEncodeError, codecs.encode, u'\xffff', 'ascii') def test_register(self): self.assertRaises(TypeError, codecs.register) + self.assertRaises(TypeError, codecs.register, 42) def test_lookup(self): self.assertRaises(TypeError, codecs.lookup) self.assertRaises(LookupError, codecs.lookup, "__spam__") + self.assertRaises(LookupError, codecs.lookup, " ") + + def test_getencoder(self): + self.assertRaises(TypeError, codecs.getencoder) + self.assertRaises(LookupError, codecs.getencoder, "__spam__") + + def test_getdecoder(self): + self.assertRaises(TypeError, codecs.getdecoder) + self.assertRaises(LookupError, codecs.getdecoder, "__spam__") + + def test_getreader(self): + self.assertRaises(TypeError, codecs.getreader) + self.assertRaises(LookupError, codecs.getreader, "__spam__") + + def test_getwriter(self): + self.assertRaises(TypeError, codecs.getwriter) + self.assertRaises(LookupError, codecs.getwriter, "__spam__") class StreamReaderTest(unittest.TestCase): |