mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
Make test_math error messages more meaningful for small discrepancies in results
This commit is contained in:
parent
df7f38face
commit
ec2ce9bbae
1 changed files with 5 additions and 1 deletions
|
@ -12,7 +12,11 @@ class MathTests(unittest.TestCase):
|
||||||
|
|
||||||
def ftest(self, name, value, expected):
|
def ftest(self, name, value, expected):
|
||||||
if abs(value-expected) > eps:
|
if abs(value-expected) > eps:
|
||||||
self.fail('%s returned %f, expected %f'%\
|
# Use %r instead of %f so the error message
|
||||||
|
# displays full precision. Otherwise discrepancies
|
||||||
|
# in the last few bits will lead to very confusing
|
||||||
|
# error messages
|
||||||
|
self.fail('%s returned %r, expected %r' %
|
||||||
(name, value, expected))
|
(name, value, expected))
|
||||||
|
|
||||||
def testConstants(self):
|
def testConstants(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue