提交 72c4382a authored 作者: lamblin's avatar lamblin

Merge pull request #1462 from nouiz/py24

Backport new exception to python 2.4
......@@ -1494,6 +1494,7 @@ def verify_grad(fun, pt, n_tests=2, rng=None, eps=None,
class GradientError(Exception):
"""This error is raised when a gradient is calculated, but incorrect."""
def __init__(self, arg, err_pos, abs_err, rel_err, abs_tol, rel_tol):
Exception.__init__(self) # to be compatible with python2.4
self.arg = arg
self.err_pos = err_pos
self.abs_err = abs_err
......
......@@ -318,6 +318,7 @@ def str_diagnostic(expected, value, rtol, atol):
class WrongValue(Exception):
def __init__(self, expected_val, val, rtol, atol):
Exception.__init__(self) # to be compatible with python2.4
self.val1 = expected_val
self.val2 = val
self.rtol = rtol
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论