Skip to content

Commit 39dc8c9

Browse files
committed
added division from __future__, to let tests work on python 2.7 again
Added seeding the numpy random generator, to prevent spurious errors when using rss system
1 parent c2f1a6e commit 39dc8c9

7 files changed

+12
-1
lines changed

tests/convert_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ def setUp(self):
3434
self.maxIO = 5
3535
# Set to True to print systems to the output.
3636
self.debug = False
37+
# get consistent results
38+
np.random.seed(9)
3739

3840
def printSys(self, sys, ind):
3941
"""Print system to the standard output."""

tests/frd_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# RvP, 4 Oct 2012
55

66

7+
from __future__ import division
78
import unittest
89
import numpy as np
910
from control.statesp import StateSpace

tests/matlab_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# nothing crashes. It doesn't test actual functionality; the module
99
# specific unit tests will do that.
1010

11-
from __future__ import print_function
11+
from __future__ import print_function, division
1212
import unittest
1313
import numpy as np
1414
from scipy.linalg import eigvals
@@ -86,6 +86,9 @@ def setUp(self):
8686
D = np.matrix("9. 0.;"
8787
"0. 9. ")
8888
self.mimo_ss1 = ss(A, B, C, D)
89+
90+
# get consistent test results
91+
np.random.seed(0)
8992

9093
def testParallel(self):
9194
sys1 = parallel(self.siso_ss1, self.siso_ss2)

tests/minreal_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# minreal_test.py - test state space class
44
# Rvp, 13 Jun 2013
55

6+
from __future__ import division
67
import unittest
78
import numpy as np
89
from scipy.linalg import eigvals

tests/statefbk_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ def setUp(self):
2020
self.maxTries = 4
2121
# Set to True to print systems to the output.
2222
self.debug = False
23+
# get consistent test results
24+
np.random.seed(0)
2325

2426
def testCtrbSISO(self):
2527
A = np.matrix("1. 2.; 3. 4.")

tests/statesp_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# statesp_test.py - test state space class
44
# RMM, 30 Mar 2011 (based on TestStateSp from v0.4a)
55

6+
from __future__ import division
67
import unittest
78
import numpy as np
89
from scipy.linalg import eigvals

tests/xferfcn_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# xferfcn_test.py - test TransferFunction class
44
# RMM, 30 Mar 2011 (based on TestXferFcn from v0.4a)
55

6+
from __future__ import division
67
import unittest
78
import numpy as np
89
from control.statesp import StateSpace, _convertToStateSpace

0 commit comments

Comments
 (0)