summaryrefslogtreecommitdiff
path: root/tests/float/math_fun.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/float/math_fun.py')
-rw-r--r--tests/float/math_fun.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/float/math_fun.py b/tests/float/math_fun.py
index d9f179587..2835b9bfb 100644
--- a/tests/float/math_fun.py
+++ b/tests/float/math_fun.py
@@ -4,8 +4,7 @@ try:
from math import *
except ImportError:
print("SKIP")
- import sys
- sys.exit()
+ raise SystemExit
test_values = [-100., -1.23456, -1, -0.5, 0.0, 0.5, 1.23456, 100.]
test_values_small = [-10., -1.23456, -1, -0.5, 0.0, 0.5, 1.23456, 10.] # so we don't overflow 32-bit precision
@@ -52,7 +51,7 @@ binary_functions = [('copysign', copysign, [(23., 42.), (-23., 42.), (23., -42.)
('atan2', atan2, ((1., 0.), (0., 1.), (2., 0.5), (-3., 5.), (-3., -4.),)),
('fmod', fmod, ((1., 1.), (0., 1.), (2., 0.5), (-3., 5.), (-3., -4.),)),
('ldexp', ldexp, ((1., 0), (0., 1), (2., 2), (3., -2), (-3., -4),)),
- ('log', log, ((2., 2.), (3., 2.), (4., 5.), (0., 1.), (1., 0.), (-1., 1.), (1., -1.))),
+ ('log', log, ((2., 2.), (3., 2.), (4., 5.), (0., 1.), (1., 0.), (-1., 1.), (1., -1.), (2., 1.))),
]
for function_name, function, test_vals in binary_functions:
@@ -60,5 +59,5 @@ for function_name, function, test_vals in binary_functions:
for value1, value2 in test_vals:
try:
print("{:.5g}".format(function(value1, value2)))
- except ValueError as e:
- print(str(e))
+ except (ValueError, ZeroDivisionError) as e:
+ print(type(e))