Author: Matti Picus <[email protected]>
Branch: win32-fixes4
Changeset: r70257:17fbb29b7174
Date: 2014-03-24 06:33 +0200
http://bitbucket.org/pypy/pypy/changeset/17fbb29b7174/
Log: start to generalize for different system code pages
diff --git a/pypy/module/_codecs/test/test_codecs.py
b/pypy/module/_codecs/test/test_codecs.py
--- a/pypy/module/_codecs/test/test_codecs.py
+++ b/pypy/module/_codecs/test/test_codecs.py
@@ -1,3 +1,5 @@
+import sys
+
class AppTestCodecs:
spaceconfig = {
"usemodules": ['unicodedata', 'struct', 'binascii'],
@@ -137,7 +139,9 @@
class AppTestPartialEvaluation:
- spaceconfig = dict(usemodules=('array',))
+ spaceconfig = dict(usemodules=['array',])
+ if sys.platform == 'win32':
+ spaceconfig['usemodules'].append('_winreg')
def test_partial_utf8(self):
import _codecs
@@ -694,8 +698,18 @@
import sys
if sys.platform != 'win32':
return
+ toencode = u'caf\xe9', 'caf\xe9'
+ try:
+ #test for non-latin1 codepage, more general test needed
+ import _winreg
+ key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,
+ r'System\CurrentControlSet\Control\Nls\CodePage')
+ if _winreg.QueryValueEx(key, 'ACP')[0] == u'1255': #non-latin1
+ toencode = u'caf\xbf','caf\xbf'
+ except:
+ assert False, 'cannot test mbcs on this windows system, check code
page'
assert u'test'.encode('mbcs') == 'test'
- assert u'caf\xe9'.encode('mbcs') == '?'
+ assert toencode[0].encode('mbcs') == toencode[1]
assert u'\u040a'.encode('mbcs') == '?' # some cyrillic letter
assert 'cafx\e9'.decode('mbcs') == u'cafx\e9'
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit