[pypy-svn] r4755 - pypy/trunk/src/pypy/translator/test
arigo at codespeak.net
arigo at codespeak.net
Mon May 31 16:13:35 CEST 2004
Author: arigo
Date: Mon May 31 16:13:34 2004
New Revision: 4755
Added:
pypy/trunk/src/pypy/translator/test/test_translator.py
Modified:
pypy/trunk/src/pypy/translator/test/test_pyrextrans.py
Log:
Started a new test file for bigger (multi-functions) tests.
Modified: pypy/trunk/src/pypy/translator/test/test_pyrextrans.py
==============================================================================
--- pypy/trunk/src/pypy/translator/test/test_pyrextrans.py (original)
+++ pypy/trunk/src/pypy/translator/test/test_pyrextrans.py Mon May 31 16:13:34 2004
@@ -83,25 +83,5 @@
self.assertEquals(sand(0, 6), "no")
self.assertEquals(sand(0, 0), "no")
-class TypedPyrexGenTestCase(NoTypePyrexGenTestCase):
-
- def build_cfunc(self, func):
- try: func = func.im_func
- except AttributeError: pass
-
- dot = testit.Options.verbose >0 and 1 or 0
- options = {
- 'simplify' : 1,
- 'dot' : dot,
- 'inputargtypes' : [int] * func.func_code.co_argcount
- }
- return build_cfunc(func, **options)
-
- # _______________________________________________________
- # The following tests require the type inference to work.
- def test_set_attr(self):
- set_attr = self.build_cfunc(t.set_attr)
- self.assertEquals(set_attr(), 2)
-
if __name__ == '__main__':
testit.main()
Added: pypy/trunk/src/pypy/translator/test/test_translator.py
==============================================================================
--- (empty file)
+++ pypy/trunk/src/pypy/translator/test/test_translator.py Mon May 31 16:13:34 2004
@@ -0,0 +1,23 @@
+import autopath
+from pypy.tool import testit
+from pypy.translator.translator import Translator
+
+from pypy.translator.test import snippet
+
+
+class TranslatorTestCase(testit.IntTestCase):
+
+ def test_set_attr(self):
+ t = Translator(snippet.set_attr)
+ t.annotate([])
+ set_attr = t.compile()
+ self.assertEquals(set_attr(), 2)
+
+ def test_inheritance2(self):
+ t = Translator(snippet.inheritance2)
+ t.annotate([])
+ inheritance2 = t.compile()
+ self.assertEquals(inheritance2(), ((-12, -12), (3, "world")))
+
+if __name__ == '__main__':
+ testit.main()
More information about the Pypy-commit
mailing list