[pypy-commit] pypy py3k: Add failing test for unimplemented feature in PyUnicode_FromWideChar()
rlamy
pypy.commits at gmail.com
Wed Oct 5 23:22:31 EDT 2016
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3k
Changeset: r87609:5de7b4b97344
Date: 2016-10-06 04:21 +0100
http://bitbucket.org/pypy/pypy/changeset/5de7b4b97344/
Log: Add failing test for unimplemented feature in
PyUnicode_FromWideChar()
diff --git a/pypy/module/cpyext/test/test_unicodeobject.py b/pypy/module/cpyext/test/test_unicodeobject.py
--- a/pypy/module/cpyext/test/test_unicodeobject.py
+++ b/pypy/module/cpyext/test/test_unicodeobject.py
@@ -134,6 +134,21 @@
res = module.aswidecharstring("Caf\xe9")
assert res == ("Caf\xe9\0", 4)
+ def test_fromwidechar(self):
+ module = self.import_extension('foo', [
+ ("truncate", "METH_O",
+ '''
+ wchar_t buffer[5] = { 0 };
+
+ if (PyUnicode_AsWideChar(args, buffer, 4) == -1)
+ return NULL;
+
+ return PyUnicode_FromWideChar(buffer, -1);
+ ''')])
+ assert module.truncate("Caf\xe9") == "Caf\xe9"
+ assert module.truncate("abcde") == "abcd"
+ assert module.truncate("ab") == "ab"
+
def test_CompareWithASCIIString(self):
module = self.import_extension('foo', [
("compare", "METH_VARARGS",
More information about the pypy-commit
mailing list