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

scipy-svn@scip... scipy-svn@scip...
Sun Jun 27 10:02:57 CDT 2010


Author: warren.weckesser
Date: 2010-06-27 10:02:57 -0500 (Sun, 27 Jun 2010)
New Revision: 6575

Modified:
   trunk/scipy/stats/tests/test_distributions.py
   trunk/scipy/stats/tests/test_morestats.py
   trunk/scipy/stats/tests/test_mstats_basic.py
   trunk/scipy/stats/tests/test_mstats_extras.py
   trunk/scipy/stats/tests/test_stats.py
Log:
TST: Don't use 'import *'.

Modified: trunk/scipy/stats/tests/test_distributions.py
===================================================================
--- trunk/scipy/stats/tests/test_distributions.py	2010-06-27 13:52:46 UTC (rev 6574)
+++ trunk/scipy/stats/tests/test_distributions.py	2010-06-27 15:02:57 UTC (rev 6575)
@@ -2,7 +2,8 @@
 
 """
 
-from numpy.testing import *
+from numpy.testing import TestCase, run_module_suite, assert_equal, \
+    assert_array_equal, assert_almost_equal, assert_array_almost_equal, rand
 
 
 import numpy
@@ -19,7 +20,7 @@
     kwds = {'size':N}
     vals = numpy.sort(dist.rvs(*args,**kwds))
     cdfvals = cdf(vals,*args)
-    q = max(abs(cdfvals-arange(1.0,N+1)/N))
+    q = max(abs(cdfvals - np.arange(1.0,N+1)/N))
     assert (q < qtest), "Failed q=%f, bound=%f, alpha=%f" % (q, qtest, significance)
     return
 
@@ -329,13 +330,16 @@
 class TestHypergeom(TestCase):
     def test_precision(self):
         # comparison number from mpmath
+        M = 2500
+        n = 50
+        N = 500
+        tot = M
+        good = n
+        hgpmf = stats.hypergeom.pmf(2, tot, good, N)
 
-        M,n,N = 2500,50,500
-        tot=M;good=n;bad=tot-good
-        hgpmf = stats.hypergeom.pmf(2,tot,good,N)
-
         assert_almost_equal(hgpmf, 0.0010114963068932233, 11)
 
+
 class TestChi2(TestCase):
     # regression tests after precision improvements, ticket:1041, not verified
     def test_precision(self):
@@ -380,7 +384,7 @@
     assert_array_equal(b, a)
     assert_array_equal(c, [2] * numpy.size(a))
 
-import sys
+
 class TestFitMethod(TestCase):
     skip = ['ncf']
     def test_fit(self):

Modified: trunk/scipy/stats/tests/test_morestats.py
===================================================================
--- trunk/scipy/stats/tests/test_morestats.py	2010-06-27 13:52:46 UTC (rev 6574)
+++ trunk/scipy/stats/tests/test_morestats.py	2010-06-27 15:02:57 UTC (rev 6575)
@@ -1,7 +1,8 @@
 # Author:  Travis Oliphant, 2002
 #
 
-from numpy.testing import *
+from numpy.testing import TestCase, run_module_suite, assert_array_equal, \
+    assert_almost_equal, assert_array_less, assert_array_almost_equal
 
 
 import scipy.stats as stats

Modified: trunk/scipy/stats/tests/test_mstats_basic.py
===================================================================
--- trunk/scipy/stats/tests/test_mstats_basic.py	2010-06-27 13:52:46 UTC (rev 6574)
+++ trunk/scipy/stats/tests/test_mstats_basic.py	2010-06-27 15:02:57 UTC (rev 6575)
@@ -9,7 +9,7 @@
 from numpy.ma import masked, nomask
 
 import scipy.stats.mstats as mstats
-from numpy.testing import *
+from numpy.testing import TestCase, run_module_suite
 from numpy.ma.testutils import assert_equal, assert_almost_equal, \
     assert_array_almost_equal
 

Modified: trunk/scipy/stats/tests/test_mstats_extras.py
===================================================================
--- trunk/scipy/stats/tests/test_mstats_extras.py	2010-06-27 13:52:46 UTC (rev 6574)
+++ trunk/scipy/stats/tests/test_mstats_extras.py	2010-06-27 15:02:57 UTC (rev 6575)
@@ -13,7 +13,8 @@
 import scipy.stats.mstats as ms
 #import scipy.stats.mmorestats as mms
 
-from numpy.testing import *
+from numpy.testing import TestCase, run_module_suite, assert_equal, \
+    assert_almost_equal
 
 
 class TestMisc(TestCase):

Modified: trunk/scipy/stats/tests/test_stats.py
===================================================================
--- trunk/scipy/stats/tests/test_stats.py	2010-06-27 13:52:46 UTC (rev 6574)
+++ trunk/scipy/stats/tests/test_stats.py	2010-06-27 15:02:57 UTC (rev 6575)
@@ -6,7 +6,9 @@
 
 """
 
-from numpy.testing import *
+from numpy.testing import TestCase, rand, assert_, assert_equal, \
+    assert_almost_equal, assert_array_almost_equal, assert_array_equal, \
+    assert_approx_equal, assert_raises, run_module_suite
 from numpy import array, arange, zeros, ravel, float32, float64, power
 import numpy as np
 
@@ -1351,7 +1353,6 @@
 def test_ttest_1samp_new():
     n1, n2, n3 = (10,15,20)
     rvn1 = stats.norm.rvs(loc=5,scale=10,size=(n1,n2,n3))
-    rvn2 = stats.norm.rvs(loc=5,scale=10,size=(n1,n2,n3))
 
     #check multidimensional array and correct axis handling
     #deterministic rvn1 and rvn2 would be better as in test_ttest_rel
@@ -1677,7 +1678,6 @@
                np.arange(24).reshape(4,6).T, 4/6.)
 
     def test_trim_mean(self):
-        a = np.arange(11)
         assert_equal(stats.trim_mean(np.arange(24).reshape(4,6).T, 2/6.),
                         np.array([  2.5,   8.5,  14.5,  20.5]))
         assert_equal(stats.trim_mean(np.arange(24).reshape(4,6), 2/6.),



More information about the Scipy-svn mailing list