[pypy-commit] pypy kill-faking: a bit of progress on teh math tests

alex_gaynor noreply at buildbot.pypy.org
Mon Dec 3 01:15:31 CET 2012


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: kill-faking
Changeset: r59280:515611fa6e51
Date: 2012-12-02 16:15 -0800
http://bitbucket.org/pypy/pypy/changeset/515611fa6e51/

Log:	a bit of progress on teh math tests

diff --git a/pypy/module/math/test/test_math.py b/pypy/module/math/test/test_math.py
--- a/pypy/module/math/test/test_math.py
+++ b/pypy/module/math/test/test_math.py
@@ -1,5 +1,5 @@
 from __future__ import with_statement
-import sys
+
 from pypy.module.math.test import test_direct
 
 
@@ -7,8 +7,16 @@
     spaceconfig = dict(usemodules=['math', 'struct', 'itertools'])
 
     def setup_class(cls):
-        cls.w_cases = cls.space.wrap(test_direct.MathTests.TESTCASES)
-        cls.w_consistent_host = cls.space.wrap(test_direct.consistent_host)
+        space = cls.space
+        cases = []
+        for a, b, expected in test_direct.MathTests.TESTCASES:
+            if type(expected) is type and issubclass(expected, Exception):
+                expected = getattr(space, "w_%s" % expected.__name__)
+            else:
+                expected = space.wrap(expected)
+            cases.append(space.newtuple([space.wrap(a), space.wrap(b), expected]))
+        cls.w_cases = space.newlist(cases)
+        cls.w_consistent_host = space.wrap(test_direct.consistent_host)
 
     def w_ftest(self, actual, expected):
         assert abs(actual - expected) < 10E-5


More information about the pypy-commit mailing list