Trent Mick <trentm@activestate.com>:

Fix test of the "math" module so it does not break on platforms that do
not offer rint(); just skip that portion of the test in that case.
This commit is contained in:
Fred Drake 2000-06-01 17:59:17 +00:00
parent b1aa19515f
commit 8eded195aa

View file

@ -130,6 +130,12 @@ testit('pow(2,1)', math.pow(2,1), 2)
testit('pow(2,-1)', math.pow(2,-1), 0.5)
print 'rint'
try:
math.rint
except AttributeError:
# this platform does not have rint, that is fine, skip the test
pass
else:
testit('rint(0.7)', math.rint(0.7), 1)
testit('rint(-0.3)', math.rint(-0.3), 0)
testit('rint(2.5)', math.rint(2.5), 2)