[Python-checkins] cpython: Issue #12281: Fix test_codecs.test_cp932() on Windows XP

victor.stinner python-checkins at python.org
Tue Oct 18 21:54:26 CEST 2011


http://hg.python.org/cpython/rev/413b89242766
changeset:   72978:413b89242766
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Tue Oct 18 21:55:25 2011 +0200
summary:
  Issue #12281: Fix test_codecs.test_cp932() on Windows XP

Cool! Decoding b'\x81\x00abc' from cp932 with replace error handler is now
giving the same result on all Windows versions.

files:
  Lib/test/test_codecs.py |  10 +++-------
  1 files changed, 3 insertions(+), 7 deletions(-)


diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py
--- a/Lib/test/test_codecs.py
+++ b/Lib/test/test_codecs.py
@@ -1810,7 +1810,7 @@
             ('[\xff]', 'replace', b'[y]'),
             ('[\u20ac]', 'replace', b'[?]'),
         ))
-        tests = [
+        self.check_decode(932, (
             (b'abc', 'strict', 'abc'),
             (b'\x82\x84\xe9\x80', 'strict', '\uff44\u9a3e'),
             # invalid bytes
@@ -1819,12 +1819,8 @@
             (b'\xff', 'replace', '\ufffd'),
             (b'\x81\x00abc', 'strict', None),
             (b'\x81\x00abc', 'ignore', '\x00abc'),
-        ]
-        if self.vista_or_later():
-            tests.append((b'\x81\x00abc', 'replace', '\ufffd\x00abc'))
-        else:
-            tests.append((b'\x81\x00abc', 'replace', '\x00\x00abc'))
-        self.check_decode(932, tests)
+            (b'\x81\x00abc', 'replace', '\ufffd\x00abc'),
+        ))
 
     def test_cp1252(self):
         self.check_encode(1252, (

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list