[pypy-svn] r72783 - pypy/branch/cpython-extension/pypy/module/cpyext/test

jandem at codespeak.net jandem at codespeak.net
Thu Mar 25 10:38:46 CET 2010


Author: jandem
Date: Thu Mar 25 10:38:44 2010
New Revision: 72783

Modified:
   pypy/branch/cpython-extension/pypy/module/cpyext/test/test_stringobject.py
Log:
Test I want to pass


Modified: pypy/branch/cpython-extension/pypy/module/cpyext/test/test_stringobject.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/test/test_stringobject.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/test/test_stringobject.py	Thu Mar 25 10:38:44 2010
@@ -39,3 +39,21 @@
         assert module.get_hello2() == 'Hello world'
         assert module.test_Size()
         raises(TypeError, module.test_Size_exception)
+
+    def test_string_buffer_init(self):
+        skip('In progress')
+        module = self.import_extension('foo', [
+            ("getstring", "METH_NOARGS",
+             """
+                 PyObject* s = PyString_FromStringAndSize(NULL, 3);
+                 char* c = PyString_AsString(s);
+                 Py_ssize_t len = PyString_Size(s);
+                 c[0] = 'a';
+                 c[1] = 'b'; 
+                 c[len-1] = 'c';
+                 return s;
+             """),
+            ])
+        s = module.getstring()
+        assert len(s) == 3
+        assert s == 'abc'



More information about the Pypy-commit mailing list