]> granicus.if.org Git - python/commitdiff
Issue #12281: Fix test_codecs.test_cp932() on Windows XP
authorVictor Stinner <victor.stinner@haypocalc.com>
Tue, 18 Oct 2011 19:55:25 +0000 (21:55 +0200)
committerVictor Stinner <victor.stinner@haypocalc.com>
Tue, 18 Oct 2011 19:55:25 +0000 (21:55 +0200)
Cool! Decoding b'\x81\x00abc' from cp932 with replace error handler is now
giving the same result on all Windows versions.

Lib/test/test_codecs.py

index 45522fc5bfe751fdb0915c20a49406fcc165bdae..fa257b814c837b8452ae2b79227f77f0e79f1e67 100644 (file)
@@ -1810,7 +1810,7 @@ class CodePageTest(unittest.TestCase):
             ('[\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 @@ class CodePageTest(unittest.TestCase):
             (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, (