diff Lib/test/test_bytes.py @ 53681:52a77ef069cd

Issue #3672: Reject surrogates in utf-8 codec; add surrogates error handler.
author Martin v. Löwis <martin@v.loewis.de>
date Sat, 02 May 2009 18:52:14 +0000
parents 4407e4d07084
children 0bb232078b8c
line wrap: on
line diff
--- a/Lib/test/test_bytes.py	Sat May 02 18:35:58 2009 +0000
+++ b/Lib/test/test_bytes.py	Sat May 02 18:52:14 2009 +0000
@@ -169,13 +169,13 @@
                     self.assertEqual(b[start:stop:step], self.type2test(L[start:stop:step]))
 
     def test_encoding(self):
-        sample = "Hello world\n\u1234\u5678\u9abc\udef0"
+        sample = "Hello world\n\u1234\u5678\u9abc"
         for enc in ("utf8", "utf16"):
             b = self.type2test(sample, enc)
             self.assertEqual(b, self.type2test(sample.encode(enc)))
         self.assertRaises(UnicodeEncodeError, self.type2test, sample, "latin1")
         b = self.type2test(sample, "latin1", "ignore")
-        self.assertEqual(b, self.type2test(sample[:-4], "utf-8"))
+        self.assertEqual(b, self.type2test(sample[:-3], "utf-8"))
 
     def test_decode(self):
         sample = "Hello world\n\u1234\u5678\u9abc\def0\def0"