[pypy-svn] r15861 - pypy/dist/pypy/rpython/test

arigo at codespeak.net arigo at codespeak.net
Tue Aug 9 21:29:55 CEST 2005


Author: arigo
Date: Tue Aug  9 21:29:53 2005
New Revision: 15861

Modified:
   pypy/dist/pypy/rpython/test/test_rstr.py
Log:
A test (failing for now) about converting string-or-none to PyStringObject.  
Fixing it would require putting PyString_FromLLCharArrayAndSize in the extfunc
table, but I'm not exactly sure how to express functions working with a
mixture of low-level and high-level types.


Modified: pypy/dist/pypy/rpython/test/test_rstr.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_rstr.py	(original)
+++ pypy/dist/pypy/rpython/test/test_rstr.py	Tue Aug  9 21:29:53 2005
@@ -431,3 +431,20 @@
     assert ''.join(res.chars) == 'a'*4
     res = interpret(f, ['a', 0])
     assert ''.join(res.chars) == ""
+
+def FIXME_test_str_to_pystringobj():
+    def f(n):
+        if n >= 0:
+            return "hello"[n:]
+        else:
+            return None
+    def g(n):
+        if n == -2:
+            return 42
+        return f(n)
+    res = interpret(g, [-1])
+    assert res._obj.value == None
+    res = interpret(g, [1])
+    assert res._obj.value == "ello"
+    res = interpret(g, [-2])
+    assert res._obj.value == 42



More information about the Pypy-commit mailing list