[pypy-commit] pypy unicode-utf8-py3: add passing test

mattip pypy.commits at gmail.com
Sun Feb 3 04:33:50 EST 2019


Author: Matti Picus <matti.picus at gmail.com>
Branch: unicode-utf8-py3
Changeset: r95781:c0c8a1eba246
Date: 2019-02-03 09:57 +0200
http://bitbucket.org/pypy/pypy/changeset/c0c8a1eba246/

Log:	add passing test

diff --git a/pypy/interpreter/test/test_unicodehelper.py b/pypy/interpreter/test/test_unicodehelper.py
--- a/pypy/interpreter/test/test_unicodehelper.py
+++ b/pypy/interpreter/test/test_unicodehelper.py
@@ -181,3 +181,12 @@
         u'12\u1234'.encode('utf8'), 'xmlcharrefreplace', handler)
     assert result == '12ሴ'
 
+ at pytest.mark.skipif(sys.platform != 'win32', reason='Windows only test')
+def test_encode_mbcs(space):
+    u = u"abc" + u"-\u5171\u0141\u2661\u0363\uDC80"
+    utf8 = u.encode('utf8')
+    with pytest.raises(UnicodeEncodeError):
+        def eh(errors, enc, msg, b, startingpos, endingpos):
+             u = b.decode('utf-8')
+             raise UnicodeEncodeError(enc, u, startingpos, endingpos, msg)
+        uh.utf8_encode_mbcs(utf8, 'strict', eh)


More information about the pypy-commit mailing list