summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_math.py
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-06-01 17:59:17 (GMT)
committerFred Drake <fdrake@acm.org>2000-06-01 17:59:17 (GMT)
commit8eded195aafd589b54b51412fd1ca61f6e932bbe (patch)
tree7dde45bb97be6f914fdc714644d24d4bf097a286 /Lib/test/test_math.py
parentb1aa19515ffdb84c6633ee0344196fd8bd50ade0 (diff)
downloadcpython-8eded195aafd589b54b51412fd1ca61f6e932bbe.zip
cpython-8eded195aafd589b54b51412fd1ca61f6e932bbe.tar.gz
cpython-8eded195aafd589b54b51412fd1ca61f6e932bbe.tar.bz2
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.
Diffstat (limited to 'Lib/test/test_math.py')
-rw-r--r--Lib/test/test_math.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py
index aec4927..5c8efc6 100644
--- a/Lib/test/test_math.py
+++ b/Lib/test/test_math.py
@@ -130,10 +130,16 @@ testit('pow(2,1)', math.pow(2,1), 2)
testit('pow(2,-1)', math.pow(2,-1), 0.5)
print 'rint'
-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)
+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)
+ testit('rint(3.5)', math.rint(3.5), 4)
print 'sin'
testit('sin(0)', math.sin(0), 0)