Author: Alex Gaynor <alex.gay...@gmail.com> Branch: kill-faking Changeset: r59282:a18b9026eeca Date: 2012-12-02 17:13 -0800 http://bitbucket.org/pypy/pypy/changeset/a18b9026eeca/
Log: get the rest of math tests passing 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,10 +1,14 @@ from __future__ import with_statement +from pypy.interpreter.function import Function +from pypy.interpreter.gateway import BuiltinCode from pypy.module.math.test import test_direct class AppTestMath: - spaceconfig = dict(usemodules=['math', 'struct', 'itertools']) + spaceconfig = { + "usemodules": ['math', 'struct', 'itertools', 'rctime', 'binascii'], + } def setup_class(cls): space = cls.space @@ -12,12 +16,20 @@ 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__) + elif callable(expected): + expected = cls.make_callable_wrapper(expected) 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) + @classmethod + def make_callable_wrapper(cls, func): + def f(space, w_x): + return space.wrap(func(space.unwrap(w_x))) + return Function(cls.space, BuiltinCode(f)) + def w_ftest(self, actual, expected): assert abs(actual - expected) < 10E-5 _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit