diff options
Diffstat (limited to 'Lib/test/test_codecs.py')
-rw-r--r-- | Lib/test/test_codecs.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py index 06cab1c..1893311 100644 --- a/Lib/test/test_codecs.py +++ b/Lib/test/test_codecs.py @@ -305,6 +305,12 @@ class UTF32Test(ReadTest): ] ) + def test_handlers(self): + self.assertEqual((u'\ufffd', 1), + codecs.utf_32_decode('\x01', 'replace', True)) + self.assertEqual((u'', 1), + codecs.utf_32_decode('\x01', 'ignore', True)) + def test_errors(self): self.assertRaises(UnicodeDecodeError, codecs.utf_32_decode, "\xff", "strict", True) @@ -422,6 +428,12 @@ class UTF16Test(ReadTest): ] ) + def test_handlers(self): + self.assertEqual((u'\ufffd', 1), + codecs.utf_16_decode('\x01', 'replace', True)) + self.assertEqual((u'', 1), + codecs.utf_16_decode('\x01', 'ignore', True)) + def test_errors(self): self.assertRaises(UnicodeDecodeError, codecs.utf_16_decode, "\xff", "strict", True) |