diff options
author | Nicolas Chauvat <nicolas.chauvat@logilab.fr> | 2010-12-27 14:44:56 +0100 |
---|---|---|
committer | Nicolas Chauvat <nicolas.chauvat@logilab.fr> | 2010-12-27 14:44:56 +0100 |
commit | 8a7bcd84b4fa5eb34a32088e89444443d96e6cc3 (patch) | |
tree | c7a70c29b4c455de23b79d627ef83245e2b43fc8 | |
parent | e770ad09f3ae646b823d6275192f4c8290885d42 (diff) | |
download | logilab-common-8a7bcd84b4fa5eb34a32088e89444443d96e6cc3.tar.gz |
[testlib] forgot qrefresh before qfinish :(
-rw-r--r-- | testlib.py | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -1040,19 +1040,21 @@ succeeded test into", osp.join(os.getcwd(), FILE_RESTART) @deprecated('Non-standard. Please use assertAlmostEqual instead.') def assertFloatAlmostEquals(self, obj, other, prec=1e-5, - relative_prec=1e-5, msg=None): + relative=False, msg=None): """compares if two floats have a distance smaller than expected precision. :param obj: a Float :param other: another Float to be comparted to <obj> :param prec: a Float describing the precision - :param relative_prec: a Float describing the relative precision + :param relative: boolean switching to relative/absolute precision :param msg: a String for a custom message """ if msg is None: msg = "%r != %r" % (obj, other) - self.assert_(math.fabs(obj - other) < prec+relative_prec*math.fabs(obj), msg) + if relative: + prec = prec*math.fabs(obj) + self.assert_(math.fabs(obj - other) < prec, msg) #@deprecated('[API] Non-standard. Please consider using a context here') def failUnlessRaises(self, excClass, callableObj, *args, **kwargs): |