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

antocuni at codespeak.net antocuni at codespeak.net
Tue Jun 6 15:56:54 CEST 2006


Author: antocuni
Date: Tue Jun  6 15:56:53 2006
New Revision: 28382

Modified:
   pypy/dist/pypy/rpython/test/test_exception.py
Log:
Yet another ootypesystem test.



Modified: pypy/dist/pypy/rpython/test/test_exception.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_exception.py	(original)
+++ pypy/dist/pypy/rpython/test/test_exception.py	Tue Jun  6 15:56:53 2006
@@ -1,7 +1,6 @@
 from pypy.translator.translator import TranslationContext
 from pypy.rpython.lltypesystem.lltype import *
-from pypy.rpython.test.test_llinterp import interpret
-
+from pypy.rpython.test.tool import BaseRtypingTest, LLRtypeMixin, OORtypeMixin
 
 class MyException(Exception):
     pass
@@ -55,14 +54,20 @@
     strgerr_inst = excdata.fn_pyexcclass2exc(pyobjectptr(MyStrangeException))
     assert strgerr_inst.typeptr == t.rtyper.class_reprs[None].getvtable()
 
+class BaseTestException(BaseRtypingTest):
+    def test_exception_with_arg(self):
+        def g(n):
+            raise OSError(n, "?")
+        def f(n):
+            try:
+                g(n)
+            except OSError, e:
+                return e.errno
+        res = self.interpret(f, [42])
+        assert res == 42
 
-def test_exception_with_arg():
-    def g(n):
-        raise OSError(n, "?")
-    def f(n):
-        try:
-            g(n)
-        except OSError, e:
-            return e.errno
-    res = interpret(f, [42])
-    assert res == 42
+class TestLLtype(BaseTestException, LLRtypeMixin):
+    pass
+
+class TestOOtype(BaseTestException, OORtypeMixin):
+    pass



More information about the Pypy-commit mailing list