|
From: <kk...@us...> - 2011-02-08 22:18:48
|
Revision: 109
http://python-control.svn.sourceforge.net/python-control/?rev=109&view=rev
Author: kkchen
Date: 2011-02-08 22:18:42 +0000 (Tue, 08 Feb 2011)
Log Message:
-----------
reorganized testing into src/test.py
I changed a bunch of things, basically enabling one to do
import control
control.tests()
I'm a little unsure on the whole setup of the directories, so if it doesn't work then
I'll fix it. -brandt
bb...@ra...
Modified Paths:
--------------
branches/control-0.4a/src/TestBDAlg.py
branches/control-0.4a/src/TestConvert.py
branches/control-0.4a/src/TestFreqRsp.py
branches/control-0.4a/src/TestMatlab.py
branches/control-0.4a/src/TestSlycot.py
branches/control-0.4a/src/TestStateSp.py
branches/control-0.4a/src/TestXferFcn.py
branches/control-0.4a/src/__init__.py
Modified: branches/control-0.4a/src/TestBDAlg.py
===================================================================
--- branches/control-0.4a/src/TestBDAlg.py 2011-02-08 22:18:35 UTC (rev 108)
+++ branches/control-0.4a/src/TestBDAlg.py 2011-02-08 22:18:42 UTC (rev 109)
@@ -159,6 +159,8 @@
[[[1., 4., 11., 16., 13.]]])
np.testing.assert_array_almost_equal(ans2.num, [[[1., 4., 7., 6.]]])
np.testing.assert_array_almost_equal(ans2.den, [[[1., 4., 9., 8., 5.]]])
+def suite():
+ return unittest.TestLoader().loadTestsFromTestCase(TestFeedback)
if __name__ == "__main__":
unittest.main()
Modified: branches/control-0.4a/src/TestConvert.py
===================================================================
--- branches/control-0.4a/src/TestConvert.py 2011-02-08 22:18:35 UTC (rev 108)
+++ branches/control-0.4a/src/TestConvert.py 2011-02-08 22:18:42 UTC (rev 109)
@@ -60,5 +60,8 @@
sys4 = matlab.tf(sys3)
self.printSys(sys4, 4)
+def suite():
+ return unittest.TestLoader().loadTestsFromTestCase(TestConvert)
+
if __name__ == "__main__":
unittest.main()
Modified: branches/control-0.4a/src/TestFreqRsp.py
===================================================================
--- branches/control-0.4a/src/TestFreqRsp.py 2011-02-08 22:18:35 UTC (rev 108)
+++ branches/control-0.4a/src/TestFreqRsp.py 2011-02-08 22:18:42 UTC (rev 109)
@@ -1,8 +1,13 @@
#!/usr/bin/env python
+### MUST BE CONVERTED TO A UNIT TEST!!!
+
+
# Script to test frequency response and frequency response plots like bode, nyquist and gang of 4.
# Especially need to ensure that nothing SISO is broken and that MIMO at least handles exceptions and has some default to SISO in place.
+
+import unittest
from statesp import StateSpace
from matlab import ss, tf, bode
import numpy as np
@@ -49,4 +54,7 @@
#plt.semilogx(omega,20*np.log10(np.squeeze(frq[0])))
#plt.figure(4)
-#bode(sysMIMO,omega)
\ No newline at end of file
+#bode(sysMIMO,omega)
+
+def suite():
+ return unittest.TestLoader().loadTestsFromTestCase(TestConvert)
Modified: branches/control-0.4a/src/TestMatlab.py
===================================================================
--- branches/control-0.4a/src/TestMatlab.py 2011-02-08 22:18:35 UTC (rev 108)
+++ branches/control-0.4a/src/TestMatlab.py 2011-02-08 22:18:42 UTC (rev 109)
@@ -40,5 +40,8 @@
# np.testing.assert_array_almost_equal(yout, youttrue,decimal=4)
+def suite():
+ return unittest.TestLoader().loadTestsFromTestCase(TestMatlab)
+
if __name__ == '__main__':
unittest.main()
Modified: branches/control-0.4a/src/TestSlycot.py
===================================================================
--- branches/control-0.4a/src/TestSlycot.py 2011-02-08 22:18:35 UTC (rev 108)
+++ branches/control-0.4a/src/TestSlycot.py 2011-02-08 22:18:42 UTC (rev 109)
@@ -1,3 +1,8 @@
+#!/usr/bin/env python
+
+#### THIS MUST BE MADE INTO A UNITTEST TO BE PART OF THE TESTING FUNCTIONS!!!!
+
+
import numpy as np
from slycot import tb04ad, td04ad
import matlab
@@ -28,3 +33,10 @@
print "sys4"
print sys4
+#These are here for once the above is made into a unittest.
+def suite():
+ return unittest.TestLoader().loadTestsFromTestCase(TestSlycot)
+
+if __name__=='__main__':
+ unittest.main()
+
Modified: branches/control-0.4a/src/TestStateSp.py
===================================================================
--- branches/control-0.4a/src/TestStateSp.py 2011-02-08 22:18:35 UTC (rev 108)
+++ branches/control-0.4a/src/TestStateSp.py 2011-02-08 22:18:42 UTC (rev 109)
@@ -199,6 +199,11 @@
p = sys.pole()
for z in p:
self.assertTrue(abs(z) < 1)
-
+
+
+def suite():
+ return unittest.TestLoader().loadTestsFromTestCase(TestStateSpace)
+
+
if __name__ == "__main__":
unittest.main()
Modified: branches/control-0.4a/src/TestXferFcn.py
===================================================================
--- branches/control-0.4a/src/TestXferFcn.py 2011-02-08 22:18:35 UTC (rev 108)
+++ branches/control-0.4a/src/TestXferFcn.py 2011-02-08 22:18:42 UTC (rev 109)
@@ -430,5 +430,8 @@
np.testing.assert_array_almost_equal(tfsys.num[i][j], num[i][j])
np.testing.assert_array_almost_equal(tfsys.den[i][j], den[i][j])
+def suite():
+ return unittest.TestLoader().loadTestsFromTestCase(TestXferFcn)
+
if __name__ == "__main__":
unittest.main()
Modified: branches/control-0.4a/src/__init__.py
===================================================================
--- branches/control-0.4a/src/__init__.py 2011-02-08 22:18:35 UTC (rev 108)
+++ branches/control-0.4a/src/__init__.py 2011-02-08 22:18:42 UTC (rev 109)
@@ -62,3 +62,5 @@
from bdalg import *
from statefbk import *
from delay import *
+
+from test import *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|