pypy/module/cpyext/test/test_unicodeobject.py::TestUnicode::()::test_codepage
self = <pypy.module.cpyext.test.test_unicodeobject.TestUnicode object at 0x0000018e2216fe88>
space = StdObjSpace
def test_codepage(self, space):
if sys.platform != 'win32':
py.test.skip("codepage encoding only exists on Windows")
chars = "abc"
w_obj = space.newtext(chars)
w_bytes = PyUnicode_EncodeCodePage(space, 932, w_obj, None)
assert space.type(w_bytes) is space.w_bytes
> assert space.utf8_w(w_bytes) == "abc"
module\cpyext\test\test_unicodeobject.py:1239:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
interpreter\baseobjspace.py:1856: in utf8_w
return w_obj.utf8_w(self)
interpreter\baseobjspace.py:271: in utf8_w
self._typed_unwrap_error(space, "str")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = W_BytesObject('abc'), space = StdObjSpace, expected = 'str'
def _typed_unwrap_error(self, space, expected):
raise oefmt(space.w_TypeError,
> "expected %s, got %T object", expected, self)
E OpErrFmt: [<W_TypeObject 'TypeError' at 0x18e1d43d168>: expected str, got bytes object]
interpreter\baseobjspace.py:315: OpErrFmt
builder: own-win-x86-64 build #2234
test: pypy/module/cpyext/test/test_unicodeobject/py/TestUnicode/()/test_codepage