mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Make floating-point exception error messages slightly more verbose: in
particular, the error message now allows one to distinguish between a ValueError arising from a singularity (e.g. log(0.)), which would usually produce +-infinity in non-stop mode, and a ValueError resulting from an invalid input (e.g. sqrt(-1.)), which would normally produce a NaN in non-stop mode.
This commit is contained in:
parent
3cbf15f07a
commit
a0de26c342
3 changed files with 24 additions and 21 deletions
|
@ -741,9 +741,9 @@ class MathTests(unittest.TestCase):
|
|||
func = getattr(math, fn)
|
||||
try:
|
||||
result = func(ar)
|
||||
except ValueError:
|
||||
message = ("Unexpected ValueError in " +
|
||||
"test %s:%s(%r)\n" % (id, fn, ar))
|
||||
except ValueError as exc:
|
||||
message = (("Unexpected ValueError: %s\n " +
|
||||
"in test %s:%s(%r)\n") % (exc.args[0], id, fn, ar))
|
||||
self.fail(message)
|
||||
self.ftest("%s:%s(%r)" % (id, fn, ar), result, er)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue