Home - Summaries: (main) : (py3.11) : Everything - Nightly builds - Benchmarks - RPython - Builders - About

pypy/module/cpyext/test/test_unicodeobject.py::TestUnicode::()::test_mbcs

self = <pypy.module.cpyext.test.test_unicodeobject.TestUnicode object at 0x0000018e2049ff68>
space = StdObjSpace

    def test_mbcs(self, space):
        if sys.platform != 'win32':
            py.test.skip("mcbs encoding only exists on Windows")
        unichars = u"abc"
        wbuf = rffi.unicode2wcharp(unichars)
        try:
            w_bytes = PyUnicode_EncodeMBCS(space, wbuf, 3, None)
        finally:
            rffi.free_wcharp(wbuf)
        assert space.type(w_bytes) is space.w_bytes
>       assert space.utf8_w(w_bytes) == "abc"

module\cpyext\test\test_unicodeobject.py:1230: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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_mbcs