pypy/module/_codecs/test/test_codecs.py::AppTestPartialEvaluation::()::test_mbcs
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x0000024f890d69c0>
def test_mbcs(self):
import sys
if sys.platform != 'win32':
return
# sanity test
from _codecs import mbcs_encode, mbcs_decode
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',b'caf\xbf'
except:
assert False, 'cannot test mbcs on this windows system, check code page'
assert u'test'.encode('mbcs') == b'test'
> assert toencode[0].encode('mbcs') == toencode[1]
E (application-level) AssertionError
[d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\_codecs\test\test_codecs.py:1380]:19: AssertionError
builder: own-win-x86-64 build #2234
test: pypy/module/_codecs/test/test_codecs/py/AppTestPartialEvaluation/()/test_mbcs