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

nik at codespeak.net nik at codespeak.net
Thu Mar 2 02:11:37 CET 2006


Author: nik
Date: Thu Mar  2 02:11:30 2006
New Revision: 23888

Modified:
   pypy/dist/pypy/rpython/test/test_rpbc.py
Log:
(pedronis, nik)
yay! all tests in test_rpbc now pass for ootype. most of the basics of
ootypesystem are now there. next up is running tests in test_rclass on
ootype.


Modified: pypy/dist/pypy/rpython/test/test_rpbc.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_rpbc.py	(original)
+++ pypy/dist/pypy/rpython/test/test_rpbc.py	Thu Mar  2 02:11:30 2006
@@ -1043,7 +1043,61 @@
         res = interpret(f, [0], type_system=self.ts)
         assert ''.join(res.chars) == 'tag2:hellotag2:< 42 >'
 
+    def test_precise_method_call_1(self):
+        class A(object):
+            def meth(self, x=5):
+                return x+1
+        class B(A):
+            def meth(self, x=5):
+                return x+2
+        class C(A):
+            pass
+        def f(i, n):
+            # call both A.meth and B.meth with an explicit argument
+            if i > 0:
+                x = A()
+            else:
+                x = B()
+            result1 = x.meth(n)
+            # now call A.meth only, using the default argument
+            result2 = C().meth()
+            return result1 * result2
+        for i in [0, 1]:
+            res = interpret(f, [i, 1234], type_system=self.ts)
+            assert res == f(i, 1234)
+
+    def test_precise_method_call_2(self):
+        class A(object):
+            def meth(self, x=5):
+                return x+1
+        class B(A):
+            def meth(self, x=5):
+                return x+2
+        class C(A):
+            def meth(self, x=5):
+                return x+3
+        def f(i, n):
+            # call both A.meth and B.meth with an explicit argument
+            if i > 0:
+                x = A()
+            else:
+                x = B()
+            result1 = x.meth(n)
+            # now call A.meth and C.meth, using the default argument
+            if i > 0:
+                x = C()
+            else:
+                x = A()
+            result2 = x.meth()
+            return result1 * result2
+        for i in [0, 1]:
+            res = interpret(f, [i, 1234], type_system=self.ts)
+            assert res == f(i, 1234)
+
+
 def test_call_from_list():
+    # Don't test with ootype, since it doesn't support lists in a
+    # coherent way yet.
     def f0(n): return n+200
     def f1(n): return n+192
     def f2(n): return n+46
@@ -1056,57 +1110,6 @@
         res = interpret(f, [i, 1000])
         assert res == f(i, 1000)
 
-def test_precise_method_call_1():
-    class A(object):
-        def meth(self, x=5):
-            return x+1
-    class B(A):
-        def meth(self, x=5):
-            return x+2
-    class C(A):
-        pass
-    def f(i, n):
-        # call both A.meth and B.meth with an explicit argument
-        if i > 0:
-            x = A()
-        else:
-            x = B()
-        result1 = x.meth(n)
-        # now call A.meth only, using the default argument
-        result2 = C().meth()
-        return result1 * result2
-    for i in [0, 1]:
-        res = interpret(f, [i, 1234])
-        assert res == f(i, 1234)
-
-def test_precise_method_call_2():
-    class A(object):
-        def meth(self, x=5):
-            return x+1
-    class B(A):
-        def meth(self, x=5):
-            return x+2
-    class C(A):
-        def meth(self, x=5):
-            return x+3
-    def f(i, n):
-        # call both A.meth and B.meth with an explicit argument
-        if i > 0:
-            x = A()
-        else:
-            x = B()
-        result1 = x.meth(n)
-        # now call A.meth and C.meth, using the default argument
-        if i > 0:
-            x = C()
-        else:
-            x = A()
-        result2 = x.meth()
-        return result1 * result2
-    for i in [0, 1]:
-        res = interpret(f, [i, 1234])
-        assert res == f(i, 1234)
-
 
 # We don't care about the following test_hlinvoke tests working on
 # ootype. Maybe later. This kind of thing is only used in rdict



More information about the Pypy-commit mailing list