Trent Mick <trentm@activestate.com>:
authorFred Drake <fdrake@acm.org>
Thu, 1 Jun 2000 17:59:17 +0000 (17:59 +0000)
committerFred Drake <fdrake@acm.org>
Thu, 1 Jun 2000 17:59:17 +0000 (17:59 +0000)
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.

Lib/test/test_math.py

index aec49273a5476810972ab0f39cd0d8d7bcdc4d25..5c8efc643122bb91e0adbe0b114be6d6b18b2945 100644 (file)
@@ -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)