[Scipy-svn] r6516 - branches/0.8.x/scipy/stats/tests

scipy-svn at scipy.org scipy-svn at scipy.org
Thu Jun 17 08:53:03 EDT 2010


Author: rgommers
Date: 2010-06-17 07:53:02 -0500 (Thu, 17 Jun 2010)
New Revision: 6516

Modified:
   branches/0.8.x/scipy/stats/tests/test_stats.py
Log:
TST: lower precision for kstest to fix test failure reported in #1196.

Backport of r6515.

Modified: branches/0.8.x/scipy/stats/tests/test_stats.py
===================================================================
--- branches/0.8.x/scipy/stats/tests/test_stats.py	2010-06-17 12:50:45 UTC (rev 6515)
+++ branches/0.8.x/scipy/stats/tests/test_stats.py	2010-06-17 12:53:02 UTC (rev 6516)
@@ -512,7 +512,7 @@
     # - multidimensional arrays (since 'a' is ravel'd as the first line in the method)
     # - very large arrays
     # - Nans, Infs, empty and otherwise bad inputs
-    
+
     # sample arrays to test the histogram with
     low_values = np.array([0.2, 0.3, 0.4, 0.5, 0.5, 0.6, 0.7, 0.8, 0.9, 1.1, 1.2],
                           dtype=float) # 11 values
@@ -567,7 +567,7 @@
                        (self.few_values, (np.array([ 4.5,  0. ,  0.1,  0. ,  0. ,  0. ,
                                                      0. ,  1. ,  0. ,  3. ]),
                                           -1., 0.4, 0)),
-                        
+
                        )
         for inputs, expected_results in basic_tests:
             # use the first lot of weights for test
@@ -1231,8 +1231,9 @@
                 np.array((0.12464329735846891, 0.089444888711820769)), 15)
     assert_almost_equal( np.array(stats.kstest(x,'norm', alternative = 'less')),
                 np.array((0.12464329735846891, 0.040989164077641749)), 15)
+    # this 'greater' test fails with precision of decimal=14
     assert_almost_equal( np.array(stats.kstest(x,'norm', alternative = 'greater')),
-                np.array((0.0072115233216310994, 0.98531158590396228)), 14)
+                np.array((0.0072115233216310994, 0.98531158590396228)), 12)
 
     #missing: no test that uses *args
 
@@ -1494,7 +1495,7 @@
         b = 31.8137186141
         self.do(a, b)
 
-    # Note the next tests use axis=None as default, not axis=0        
+    # Note the next tests use axis=None as default, not axis=0
     def test_2dlist(self):
         ''' Test a 2d list'''
         a=[[10, 20, 30, 40], [50, 60, 70, 80], [90, 100, 110, 120]]
@@ -1663,7 +1664,7 @@
         assert_equal(stats.trim1(a, 0.2), np.arange(9))
         assert_equal(stats.trim1(a, 0.2, tail='left'), np.arange(2,11))
         assert_equal(stats.trim1(a, 3/11., tail='left'), np.arange(3,11))
-    
+
     def test_trimboth(self):
         a = np.arange(11)
         assert_equal(stats.trimboth(a, 3/11.), np.arange(3,8))
@@ -1672,7 +1673,7 @@
                      np.arange(4,20).reshape(4,4))
         assert_equal(stats.trimboth(np.arange(24).reshape(4,6).T, 2/6.),
                np.array([[ 2,  8, 14, 20],[ 3,  9, 15, 21]]))
-        assert_raises(ValueError, stats.trimboth, 
+        assert_raises(ValueError, stats.trimboth,
                np.arange(24).reshape(4,6).T, 4/6.)
 
     def test_trim_mean(self):
@@ -1706,7 +1707,7 @@
         assert_equal(upp, c.mean() + fact*c.std())
         assert_equal(c.size, 4)
         assert_equal(a.size, 36) #check original array unchanged
-        
+
     def test_sigmaclip3(self):
         a = np.concatenate((np.linspace(9.5,10.5,11),np.linspace(-100,-50,3)))
         fact = 1.8




More information about the Scipy-svn mailing list