[pypy-svn] r49374 - pypy/dist/pypy/rlib/test

fijal at codespeak.net fijal at codespeak.net
Wed Dec 5 12:57:05 CET 2007


Author: fijal
Date: Wed Dec  5 12:57:04 2007
New Revision: 49374

Added:
   pypy/dist/pypy/rlib/test/test_debug.py   (contents, props changed)
Log:
Forgotten test.


Added: pypy/dist/pypy/rlib/test/test_debug.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/rlib/test/test_debug.py	Wed Dec  5 12:57:04 2007
@@ -0,0 +1,29 @@
+
+import py
+from pypy.rlib.debug import check_annotation
+from pypy.rpython.test.test_llinterp import interpret
+
+def test_check_annotation():
+    class Error(Exception):
+        pass
+    
+    def checker(ann, bk):
+        from pypy.annotation.model import SomeList, SomeInteger
+        if not isinstance(ann, SomeList):
+            raise Error()
+        if not isinstance(ann.listdef.listitem.s_value, SomeInteger):
+            raise Error()
+    
+    def f(x):
+        result = [x]
+        check_annotation(result, checker)
+        return result
+
+    interpret(f, [3])
+
+    def g(x):
+        check_annotation(x, checker)
+        return x
+
+    py.test.raises(Error, "interpret(g, [3])")
+



More information about the Pypy-commit mailing list