[Scipy-svn] r6761 - trunk/scipy/stats/tests

scipy-svn@scip... scipy-svn@scip...
Sat Sep 11 20:00:45 CDT 2010


Author: ptvirtan
Date: 2010-09-11 20:00:45 -0500 (Sat, 11 Sep 2010)
New Revision: 6761

Modified:
   trunk/scipy/stats/tests/test_stats.py
Log:
TST: stats: accept rounding to even on Python 3

Modified: trunk/scipy/stats/tests/test_stats.py
===================================================================
--- trunk/scipy/stats/tests/test_stats.py	2010-09-12 01:00:29 UTC (rev 6760)
+++ trunk/scipy/stats/tests/test_stats.py	2010-09-12 01:00:45 UTC (rev 6761)
@@ -12,6 +12,7 @@
     assert_approx_equal, assert_raises, run_module_suite
 from numpy import array, arange, zeros, ravel, float32, float64, power
 import numpy as np
+import sys
 
 import scipy.stats as stats
 
@@ -79,9 +80,15 @@
             numbers inconsistently). Needless to say, statical packages
             written in these languages may fail the test as well.
         """
-        for i in range(0,9):
-            y = round(ROUND[i])
-            assert_equal(y,i+1)
+        if sys.version_info[0] >= 3:
+            # round to even
+            for i in range(0,9):
+                y = round(ROUND[i])
+                assert_equal(y, 2*((i+1)//2))
+        else:
+            for i in range(0,9):
+                y = round(ROUND[i])
+                assert_equal(y,i+1)
 
     def test_rounding1(self):
         """ W.II.A.1. Y = INT(2.6*7 -0.2) (Y should be 18)"""



More information about the Scipy-svn mailing list