Skip to content

Commit d19f43d

Browse files
committed
moved unit tests into a separate directory; use 'python tests/test_all.py' to run all tests
1 parent a518740 commit d19f43d

13 files changed

Lines changed: 132 additions & 27 deletions

ChangeLog

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
2011-03-30 Richard Murray <murray@malabar.local>
2+
3+
* tests/: added top level subdirectory, to be used for unit tests.
4+
The idea in putting the code here is that you can do 'setup.py test'
5+
during installation to make sure everything is working correctly.
6+
The test code would normally *not* be callable from the installed
7+
module.
8+
9+
* tests/*_test.py: moved from src/Test*.py
10+
11+
* setup.py: updated version number.
12+
113
2011-02-13 Richard Murray <murray@sumatra.local>
214

315
* src/*.py: added svn:keywords Id properly

Pending

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ picture" things that need to be done.
99
to be implemented.
1010

1111
OPEN BUGS
12-
* step() doesn't handle systems with a pole at the origin (use lsim2)
12+
* matlab.step() doesn't handle systems with a pole at the origin (use lsim2)
13+
* tests/convert_test.py not working yet
14+
* tests/test_all.py should report on failed tests
15+
* tests/freqresp.py needs to be converted to unit test
1316

1417
Transfer code from Roberto Bucher's yottalab to python-control
1518
acker - pole placement using Ackermann method

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
from distutils.core import setup
44

55
setup(name='control',
6-
version='0.4a',
6+
version='0.4b',
77
description='Python Control Systems Library',
88
author='Richard Murray',
99
author_email='murray@cds.caltech.edu',
1010
url='http://python-control.sourceforge.net',
1111
requires='scipy',
12-
package_dir = {'control':'src'},
1312
packages=['control'],
13+
package_dir = {'control':'src'},
1414
)

src/TestBDAlg.py renamed to tests/bdalg_test.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
#!/usr/bin/env python
2+
#
3+
# bdalg_test.py - test suit for block diagram algebra
4+
# RMM, 30 Mar 2011 (based on TestBDAlg from v0.4a)
25

3-
import numpy as np
4-
from xferfcn import TransferFunction
5-
from statesp import StateSpace
6-
from bdalg import feedback
76
import unittest
7+
import numpy as np
8+
from control.xferfcn import TransferFunction
9+
from control.statesp import StateSpace
10+
from control.bdalg import feedback
811

912
class TestFeedback(unittest.TestCase):
1013
"""These are tests for the feedback function in bdalg.py. Currently, some
@@ -159,6 +162,7 @@ def testTFTF(self):
159162
[[[1., 4., 11., 16., 13.]]])
160163
np.testing.assert_array_almost_equal(ans2.num, [[[1., 4., 7., 6.]]])
161164
np.testing.assert_array_almost_equal(ans2.den, [[[1., 4., 9., 8., 5.]]])
165+
162166
def suite():
163167
return unittest.TestLoader().loadTestsFromTestCase(TestFeedback)
164168

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
1515
"""
1616

17-
import numpy as np
18-
import matlab
1917
import unittest
18+
import numpy as np
19+
import control.matlab as matlab
2020

2121
class TestConvert(unittest.TestCase):
2222
"""Test state space and transfer function conversions."""
File renamed without changes.
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
#!/usr/bin/env python
2+
#
3+
# matlab_test.py - test MATLAB compatibility
4+
# RMM, 30 Mar 2011 (based on TestMatlab from v0.4a)
25

3-
from matlab import *
4-
import numpy as np
56
import unittest
7+
import numpy as np
8+
from control.matlab import *
69

710
class TestMatlab(unittest.TestCase):
811
def testStep(self):
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
#!/usr/bin/env python
2+
#
3+
# modelsimp_test.py - test model reduction functions
4+
# RMM, 30 Mar 2011 (based on TestModelSimp from v0.4a)
25

3-
from modelsimp import *
4-
from matlab import *
5-
import numpy as np
66
import unittest
7+
import numpy as np
8+
from control.modelsimp import *
9+
from control.matlab import *
710

811
class TestModelsimp(unittest.TestCase):
912
def testHSVD(self):
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#!/usr/bin/env python
2+
#
3+
# slycot_convert_test.py - test SLICOT-based conversions
4+
# RMM, 30 Mar 2011 (based on TestSlycot from v0.4a)
25

3-
6+
import unittest
47
import numpy as np
58
from slycot import tb04ad, td04ad
6-
import matlab
7-
import unittest
8-
9+
import control.matlab as matlab
910

1011
class TestSlycot(unittest.TestCase):
1112
"""TestSlycot compares transfer function and state space conversions for
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
#!/usr/bin/env python
2+
#
3+
# statefbk_test.py - test state feedback functions
4+
# RMM, 30 Mar 2011 (based on TestStatefbk from v0.4a)
25

3-
from statefbk import ctrb, obsv, place, lqr, gram
4-
from matlab import *
5-
import numpy as np
66
import unittest
7+
import numpy as np
8+
from control.statefbk import ctrb, obsv, place, lqr, gram
9+
from control.matlab import *
710

811
class TestStatefbk(unittest.TestCase):
912
def testCtrbSISO(self):

0 commit comments

Comments
 (0)