[pypy-svn] r49816 - in pypy/dist/pypy/rpython: module/test ootypesystem/test test

pedronis at codespeak.net pedronis at codespeak.net
Sat Dec 15 16:34:11 CET 2007


Author: pedronis
Date: Sat Dec 15 16:34:09 2007
New Revision: 49816

Modified:
   pypy/dist/pypy/rpython/module/test/test_ll_strtod.py
   pypy/dist/pypy/rpython/ootypesystem/test/test_oortype.py
   pypy/dist/pypy/rpython/test/test_llinterp.py
   pypy/dist/pypy/rpython/test/test_rbuiltin.py
   pypy/dist/pypy/rpython/test/test_rlist.py
   pypy/dist/pypy/rpython/test/test_rstr.py
   pypy/dist/pypy/rpython/test/test_runicode.py
Log:
don't special case strings/unicode consistently for oo/ll in get_interpreter anymore, in the few places that this was used use hlstr instead.

fixes oo tests that started failing.



Modified: pypy/dist/pypy/rpython/module/test/test_ll_strtod.py
==============================================================================
--- pypy/dist/pypy/rpython/module/test/test_ll_strtod.py	(original)
+++ pypy/dist/pypy/rpython/module/test/test_ll_strtod.py	Sat Dec 15 16:34:09 2007
@@ -11,7 +11,11 @@
         assert self.ll_to_string(self.interpret(f, [3.0])) == f(3.0)
 
     def test_parts_to_float(self):
+        from pypy.rpython.annlowlevel import hlstr
+        
         def f(a, b, c, d):
+            a,b,c,d = hlstr(a), hlstr(b), hlstr(c), hlstr(d)
+            
             return rarithmetic.parts_to_float(a, b, c, d)
         
         data = [

Modified: pypy/dist/pypy/rpython/ootypesystem/test/test_oortype.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/test/test_oortype.py	(original)
+++ pypy/dist/pypy/rpython/ootypesystem/test/test_oortype.py	Sat Dec 15 16:34:09 2007
@@ -194,7 +194,6 @@
     assert rtyper.exceptiondata.is_exception_instance(INST)
 
 def test_string_annotation():
-    py.test.skip("XXX interpret() does special magic about String arguments")
     def oof(lst):
         return lst.ll_strlen()
 

Modified: pypy/dist/pypy/rpython/test/test_llinterp.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_llinterp.py	(original)
+++ pypy/dist/pypy/rpython/test/test_llinterp.py	Sat Dec 15 16:34:09 2007
@@ -85,10 +85,6 @@
             T = typeOf(x)
             if T == Ptr(PyObject) and someobjects:
                 return object
-            elif T == Ptr(rstr.STR) or T == ootype.String:
-                return str
-            elif T == Ptr(rstr.UNICODE) or T == ootype.Unicode:
-                return unicode
             else:
                 return lltype_to_annotation(T)
 

Modified: pypy/dist/pypy/rpython/test/test_rbuiltin.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_rbuiltin.py	(original)
+++ pypy/dist/pypy/rpython/test/test_rbuiltin.py	Sat Dec 15 16:34:09 2007
@@ -288,8 +288,11 @@
 
     def test_os_path_exists(self):
         self._skip_llinterpreter("os.stat()")
+        from pypy.rpython.annlowlevel import hlstr
+        
         import os
         def f(fn):
+            fn = hlstr(fn)
             return os.path.exists(fn)
         filename = self.string_to_ll(str(py.magic.autopath()))
         assert self.interpret(f, [filename]) == True
@@ -298,8 +301,11 @@
 
     def test_os_isdir(self):
         self._skip_llinterpreter("os.stat()")
+        from pypy.rpython.annlowlevel import hlstr
+        
         import os
         def f(fn):
+            fn = hlstr(fn)
             return os.path.isdir(fn)
         assert self.interpret(f, [self.string_to_ll("/")]) == True
         assert self.interpret(f, [self.string_to_ll(str(py.magic.autopath()))]) == False

Modified: pypy/dist/pypy/rpython/test/test_rlist.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_rlist.py	(original)
+++ pypy/dist/pypy/rpython/test/test_rlist.py	Sat Dec 15 16:34:09 2007
@@ -1392,8 +1392,10 @@
 
     def test_hints(self):
         from pypy.rlib.objectmodel import newlist
-
+        from pypy.rpython.annlowlevel import hlstr
+        
         def f(z):
+            z = hlstr(z)
             x = newlist(sizehint=13)
             x += z
             return ''.join(x)

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	Sat Dec 15 16:34:09 2007
@@ -700,15 +700,6 @@
             return const('ababa').count(const('aba'))
         res = self.interpret(fn, [])
         assert res == 1
-
-    def test_hlstr(self):
-        const = self.const
-        from pypy.rpython.annlowlevel import hlstr
-        def f(s):
-            return const("*")+const(hlstr(s))+const("*") == const("*abba*")
-
-        res = self.interpret(f, [self.string_to_ll(const("abba"))])
-        assert res
        
     def test_getitem_exc(self):
         const = self.const
@@ -781,8 +772,10 @@
         assert summary(fgraph) == {}
 
     def test_inplace_add(self):
+        from pypy.rpython.annlowlevel import hlstr
         const = self.const
         def f(x, y):
+            y = const(hlstr(y))
             if x > 0:
                 l = [const('a'), const('b')]
             else:
@@ -790,8 +783,17 @@
             l += y
             return const('').join(l)
 
-        assert self.ll_to_string(self.interpret(f, [1, self.string_to_ll(const('abc'))])) == 'ababc'
+        assert self.ll_to_string(self.interpret(f, [1,
+                                       self.string_to_ll('abc')])) == 'ababc'
         
+    def test_hlstr(self):
+        const = self.const
+        from pypy.rpython.annlowlevel import hlstr
+        def f(s):
+            return const("*")+const(hlstr(s))+const("*") == const("*abba*")
+
+        res = self.interpret(f, [self.string_to_ll(const("abba"))])
+        assert res
 
 def FIXME_test_str_to_pystringobj():
     def f(n):

Modified: pypy/dist/pypy/rpython/test/test_runicode.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_runicode.py	(original)
+++ pypy/dist/pypy/rpython/test/test_runicode.py	Sat Dec 15 16:34:09 2007
@@ -215,19 +215,6 @@
         py.test.skip("We should think how to solve this problem")
     test_rfind_empty_string = test_find_empty_string
 
-
-    def test_inplace_add(self):
-        const = self.const
-        def f(x, y):
-            if x > 0:
-                l = [const('a'), const('b')]
-            else:
-                l = [const('a')]
-            l += y
-            return const('').join(l)
-
-        assert self.ll_to_unicode(self.interpret(f, [1, self.unicode_to_ll(const('abc'))])) == 'ababc'
-
 class TestLLtype(BaseTestRUnicode, LLRtypeMixin):
     EMPTY_STRING_HASH = -1
 



More information about the Pypy-commit mailing list