mirror of
https://github.com/python/cpython.git
synced 2025-09-18 22:50:26 +00:00
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:
parent
b1aa19515f
commit
8eded195aa
1 changed files with 10 additions and 4 deletions
|
@ -130,10 +130,16 @@ testit('pow(2,1)', math.pow(2,1), 2)
|
||||||
testit('pow(2,-1)', math.pow(2,-1), 0.5)
|
testit('pow(2,-1)', math.pow(2,-1), 0.5)
|
||||||
|
|
||||||
print 'rint'
|
print 'rint'
|
||||||
testit('rint(0.7)', math.rint(0.7), 1)
|
try:
|
||||||
testit('rint(-0.3)', math.rint(-0.3), 0)
|
math.rint
|
||||||
testit('rint(2.5)', math.rint(2.5), 2)
|
except AttributeError:
|
||||||
testit('rint(3.5)', math.rint(3.5), 4)
|
# 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)
|
||||||
|
testit('rint(3.5)', math.rint(3.5), 4)
|
||||||
|
|
||||||
print 'sin'
|
print 'sin'
|
||||||
testit('sin(0)', math.sin(0), 0)
|
testit('sin(0)', math.sin(0), 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue