[Scipy-svn] r2549 - trunk/Lib/sandbox/models/tests
scipy-svn at scipy.org
scipy-svn at scipy.org
Sun Jan 14 08:23:47 CST 2007
Author: jarrod.millman
Date: 2007-01-14 08:23:43 -0600 (Sun, 14 Jan 2007)
New Revision: 2549
Added:
trunk/Lib/sandbox/models/tests/test_rlm.py
Removed:
trunk/Lib/sandbox/models/tests/__init__.py
trunk/Lib/sandbox/models/tests/test_robust.py
Modified:
trunk/Lib/sandbox/models/tests/test_formula.py
trunk/Lib/sandbox/models/tests/test_glm.py
trunk/Lib/sandbox/models/tests/test_regression.py
trunk/Lib/sandbox/models/tests/test_utils.py
Log:
minor fixes of the models.test()
Deleted: trunk/Lib/sandbox/models/tests/__init__.py
===================================================================
--- trunk/Lib/sandbox/models/tests/__init__.py 2007-01-14 13:52:31 UTC (rev 2548)
+++ trunk/Lib/sandbox/models/tests/__init__.py 2007-01-14 14:23:43 UTC (rev 2549)
@@ -1,10 +0,0 @@
-import unittest
-
-from scipy.sandbox.models.tests import test_formula
-from scipy.sandbox.models.tests import test_regression
-from scipy.sandbox.models.tests import test_utils
-
-def suite():
- return unittest.TestSuite([test_formula.suite(),
- test_regression.suite(),
- test_utils.suite()])
Modified: trunk/Lib/sandbox/models/tests/test_formula.py
===================================================================
--- trunk/Lib/sandbox/models/tests/test_formula.py 2007-01-14 13:52:31 UTC (rev 2548)
+++ trunk/Lib/sandbox/models/tests/test_formula.py 2007-01-14 14:23:43 UTC (rev 2549)
@@ -1,7 +1,8 @@
-import csv
-import os
+"""
+Test functions for models.formula
+"""
+
import string
-#import unittest
import numpy as N
import numpy.random as R
@@ -226,11 +227,5 @@
self.assertEquals(estimable, False)
-#def suite():
-# suite = unittest.makeSuite(formulaTest)
-# return suite
-
if __name__ == "__main__":
NumpyTest().run()
-#if __name__ == '__main__':
-# unittest.main()
Modified: trunk/Lib/sandbox/models/tests/test_glm.py
===================================================================
--- trunk/Lib/sandbox/models/tests/test_glm.py 2007-01-14 13:52:31 UTC (rev 2548)
+++ trunk/Lib/sandbox/models/tests/test_glm.py 2007-01-14 14:23:43 UTC (rev 2549)
@@ -1,11 +1,13 @@
-#import unittest
+"""
+Test functions for models.glm
+"""
import numpy as N
import numpy.random as R
from numpy.testing import NumpyTest, NumpyTestCase
import scipy.sandbox.models as S
-from scipy.sandbox.models.glm import model
+import scipy.sandbox.models.glm as models
W = R.standard_normal
@@ -15,7 +17,7 @@
X = W((40,10))
Y = N.greater(W((40,)), 0)
family = S.family.Binomial()
- cmodel = model(design=X, family=S.family.Binomial())
+ cmodel = models(design=X, family=S.family.Binomial())
results = cmodel.fit(Y)
self.assertEquals(results.df_resid, 30)
@@ -24,10 +26,9 @@
X[:,0] = X[:,1] + X[:,2]
Y = N.greater(W((40,)), 0)
family = S.family.Binomial()
- cmodel = model(design=X, family=S.family.Binomial())
+ cmodel = models(design=X, family=S.family.Binomial())
results = cmodel.fit(Y)
self.assertEquals(results.df_resid, 31)
-
if __name__ == "__main__":
NumpyTest().run()
Modified: trunk/Lib/sandbox/models/tests/test_regression.py
===================================================================
--- trunk/Lib/sandbox/models/tests/test_regression.py 2007-01-14 13:52:31 UTC (rev 2548)
+++ trunk/Lib/sandbox/models/tests/test_regression.py 2007-01-14 14:23:43 UTC (rev 2549)
@@ -1,4 +1,6 @@
-#import unittest
+"""
+Test functions for models.regression
+"""
from numpy.random import standard_normal
from numpy.testing import NumpyTest, NumpyTestCase
@@ -41,5 +43,3 @@
if __name__ == "__main__":
NumpyTest().run()
-#if __name__ == '__main__':
-# unittest.main()
Copied: trunk/Lib/sandbox/models/tests/test_rlm.py (from rev 2548, trunk/Lib/sandbox/models/tests/test_robust.py)
===================================================================
--- trunk/Lib/sandbox/models/tests/test_robust.py 2007-01-14 13:52:31 UTC (rev 2548)
+++ trunk/Lib/sandbox/models/tests/test_rlm.py 2007-01-14 14:23:43 UTC (rev 2549)
@@ -0,0 +1,30 @@
+"""
+Test functions for models.rlm
+"""
+
+import numpy.random as R
+from numpy.testing import NumpyTest, NumpyTestCase
+
+import scipy.sandbox.models.rlm as models
+
+W = R.standard_normal
+
+class test_Regression(NumpyTestCase):
+
+ def test_Robust(self):
+ X = W((40,10))
+ Y = W((40,))
+ model = models(design=X)
+ results = model.fit(Y)
+ self.assertEquals(results.df_resid, 30)
+
+ def test_Robustdegenerate(self):
+ X = W((40,10))
+ X[:,0] = X[:,1] + X[:,2]
+ Y = W((40,))
+ model = models(design=X)
+ results = model.fit(Y)
+ self.assertEquals(results.df_resid, 31)
+
+if __name__ == "__main__":
+ NumpyTest().run()
Deleted: trunk/Lib/sandbox/models/tests/test_robust.py
===================================================================
--- trunk/Lib/sandbox/models/tests/test_robust.py 2007-01-14 13:52:31 UTC (rev 2548)
+++ trunk/Lib/sandbox/models/tests/test_robust.py 2007-01-14 14:23:43 UTC (rev 2549)
@@ -1,30 +0,0 @@
-#import unittest
-
-import numpy.random as R
-from numpy.testing import NumpyTest, NumpyTestCase
-
-import scipy.sandbox.models as S
-
-W = R.standard_normal
-
-class RegressionTest(NumpyTestCase):
-
- def testRobust(self):
- X = W((40,10))
- Y = W((40,))
- model = S.rlm(design=X)
- results = model.fit(Y)
- self.assertEquals(results.df_resid, 30)
-
- def testRobustdegenerate(self):
- X = W((40,10))
- X[:,0] = X[:,1] + X[:,2]
- Y = W((40,))
- model = S.rlm(design=X)
- results = model.fit(Y)
- self.assertEquals(results.df_resid, 31)
-
-if __name__ == "__main__":
- NumpyTest().run()
-#if __name__ == '__main__':
-# unittest.main()
Modified: trunk/Lib/sandbox/models/tests/test_utils.py
===================================================================
--- trunk/Lib/sandbox/models/tests/test_utils.py 2007-01-14 13:52:31 UTC (rev 2548)
+++ trunk/Lib/sandbox/models/tests/test_utils.py 2007-01-14 14:23:43 UTC (rev 2549)
@@ -1,10 +1,12 @@
-#import unittest
+"""
+Test functions for models.utils
+"""
import numpy as N
import numpy.random as R
from numpy.testing import assert_almost_equal, NumpyTest, NumpyTestCase
+
import scipy
-
from scipy.sandbox.models import utils
class test_Utils(NumpyTestCase):
@@ -55,5 +57,3 @@
if __name__ == "__main__":
NumpyTest().run()
-#if __name__ == '__main__':
-# unittest.main()
More information about the Scipy-svn
mailing list