[pypy-svn] r72542 - pypy/trunk/pypy/module/cpyext/test

jandem at codespeak.net jandem at codespeak.net
Mon Mar 22 13:38:39 CET 2010


Author: jandem
Date: Mon Mar 22 13:38:37 2010
New Revision: 72542

Modified:
   pypy/trunk/pypy/module/cpyext/test/test_stringobject.py
Log:
Add PyString_Size


Modified: pypy/trunk/pypy/module/cpyext/test/test_stringobject.py
==============================================================================
--- pypy/trunk/pypy/module/cpyext/test/test_stringobject.py	(original)
+++ pypy/trunk/pypy/module/cpyext/test/test_stringobject.py	Mon Mar 22 13:38:37 2010
@@ -19,9 +19,21 @@
         {
             return PyString_FromString("Hello world");
         }
+        static PyObject* foo_test_Size(PyObject* self, PyObject *args)
+        {
+            PyObject* s = PyString_FromString("Hello world");
+            int result = 0;
+            
+            if(PyString_Size(s) == 11) {
+                result = 1;
+            }
+            Py_DECREF(s);
+            return PyBool_FromLong(result);
+        }
         static PyMethodDef methods[] = {
             { "get_hello1", foo_get_hello1, METH_NOARGS },
             { "get_hello2", foo_get_hello2, METH_NOARGS },
+            { "test_Size", foo_test_Size, METH_NOARGS },
             { NULL }
         };
         """
@@ -29,3 +41,4 @@
         assert 'foo' in sys.modules
         assert module.get_hello1() == 'Hello world'
         assert module.get_hello2() == 'Hello world'
+        assert module.test_Size()



More information about the Pypy-commit mailing list