summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/float/math_domain.py14
-rw-r--r--tests/float/math_domain_special.py8
-rw-r--r--tests/float/math_fun.py15
-rw-r--r--tests/float/math_fun_special.py6
4 files changed, 21 insertions, 22 deletions
diff --git a/tests/float/math_domain.py b/tests/float/math_domain.py
index d4c45fa3b..063d509b5 100644
--- a/tests/float/math_domain.py
+++ b/tests/float/math_domain.py
@@ -30,12 +30,12 @@ for name, f, args in (
):
for x in args + (inf, -inf, nan):
try:
- ans = f(x)
- print("%.4f" % ans)
+ ans = "%.4f" % f(x)
except ValueError:
- print(name, "ValueError")
+ ans = "ValueError"
except OverflowError:
- print(name, "OverflowError")
+ ans = "OverflowError"
+ print("%s(%.4f) = %s" % (name, x, ans))
# double argument functions
for name, f, args in (
@@ -47,7 +47,7 @@ for name, f, args in (
):
for x in args + ((0, inf), (inf, 0), (inf, inf), (inf, nan), (nan, inf), (nan, nan)):
try:
- ans = f(*x)
- print("%.4f" % ans)
+ ans = "%.4f" % f(*x)
except ValueError:
- print(name, "ValueError")
+ ans = "ValueError"
+ print("%s(%.4f, %.4f) = %s" % (name, x[0], x[1], ans))
diff --git a/tests/float/math_domain_special.py b/tests/float/math_domain_special.py
index 880594dce..ddabf178a 100644
--- a/tests/float/math_domain_special.py
+++ b/tests/float/math_domain_special.py
@@ -29,9 +29,9 @@ for name, f, args in (
):
for x in args + (inf, -inf, nan):
try:
- ans = f(x)
- print("%.4f" % ans)
+ ans = "%.4f" % f(x)
except ValueError:
- print(name, "ValueError")
+ ans = "ValueError"
except OverflowError:
- print(name, "OverflowError")
+ ans = "OverflowError"
+ print("%s(%.4f) = %s" % (name, x, ans))
diff --git a/tests/float/math_fun.py b/tests/float/math_fun.py
index 0d443a475..789158c0e 100644
--- a/tests/float/math_fun.py
+++ b/tests/float/math_fun.py
@@ -38,12 +38,12 @@ functions = [
]
for function_name, function, test_vals in functions:
- print(function_name)
for value in test_vals:
try:
- print("{:.5g}".format(function(value)))
+ ans = "{:.5g}".format(function(value))
except ValueError as e:
- print(str(e))
+ ans = str(e)
+ print("{}({:.5g}) = {}".format(function_name, value, ans))
tuple_functions = [
("frexp", frexp, test_values),
@@ -51,10 +51,9 @@ tuple_functions = [
]
for function_name, function, test_vals in tuple_functions:
- print(function_name)
for value in test_vals:
x, y = function(value)
- print("{:.5g} {:.5g}".format(x, y))
+ print("{}({:.5g}) = ({:.5g}, {:.5g})".format(function_name, value, x, y))
binary_functions = [
(
@@ -83,9 +82,9 @@ binary_functions = [
]
for function_name, function, test_vals in binary_functions:
- print(function_name)
for value1, value2 in test_vals:
try:
- print("{:.5g}".format(function(value1, value2)))
+ ans = "{:.5g}".format(function(value1, value2))
except (ValueError, ZeroDivisionError) as e:
- print(type(e))
+ ans = type(e)
+ print("{}({:.5g}, {:.5g}) = {}".format(function_name, value1, value2, ans))
diff --git a/tests/float/math_fun_special.py b/tests/float/math_fun_special.py
index 614470c0f..e674ec8df 100644
--- a/tests/float/math_fun_special.py
+++ b/tests/float/math_fun_special.py
@@ -44,9 +44,9 @@ functions = [
]
for function_name, function, test_vals in functions:
- print(function_name)
for value in test_vals:
try:
- print("{:.4g}".format(function(value)))
+ ans = "{:.4g}".format(function(value))
except ValueError as e:
- print(str(e))
+ ans = str(e)
+ print("{}({:.4g}) = {}".format(function_name, value, ans))