|
5 | 5 |
|
6 | 6 | from __future__ import print_function
|
7 | 7 | import unittest
|
| 8 | +import sys as pysys |
8 | 9 | import numpy as np
|
9 | 10 | import warnings
|
10 | 11 | from control.statefbk import ctrb, obsv, place, place_varga, lqr, gram, acker
|
@@ -37,6 +38,14 @@ def testCtrbSISO(self):
|
37 | 38 | np.testing.assert_array_almost_equal(Wc, Wctrue)
|
38 | 39 | self.assertTrue(isinstance(Wc, StateSpaceMatrix))
|
39 | 40 |
|
| 41 | + # This test only works in Python 3 due to a conflict with the same |
| 42 | + # warning type in other test modules (frd_test.py). See |
| 43 | + # https://bugs.python.org/issue4180 for more details |
| 44 | + @unittest.skipIf(pysys.version_info < (3, 0), "test requires Python 3+") |
| 45 | + def test_ctrb_siso_deprecated(self): |
| 46 | + A = np.array([[1., 2.], [3., 4.]]) |
| 47 | + B = np.array([[5.], [7.]]) |
| 48 | + |
40 | 49 | # Check that default using np.matrix generates a warning
|
41 | 50 | # TODO: remove this check with matrix type is deprecated
|
42 | 51 | use_numpy_matrix(True)
|
@@ -66,6 +75,14 @@ def testObsvSISO(self):
|
66 | 75 | # Make sure default type values are correct
|
67 | 76 | self.assertTrue(isinstance(Wo, np.ndarray))
|
68 | 77 |
|
| 78 | + # This test only works in Python 3 due to a conflict with the same |
| 79 | + # warning type in other test modules (frd_test.py). See |
| 80 | + # https://bugs.python.org/issue4180 for more details |
| 81 | + @unittest.skipIf(pysys.version_info < (3, 0), "test requires Python 3+") |
| 82 | + def test_obsv_siso_deprecated(self): |
| 83 | + A = np.array([[1., 2.], [3., 4.]]) |
| 84 | + C = np.array([[5., 7.]]) |
| 85 | + |
69 | 86 | # Check that default type generates a warning
|
70 | 87 | # TODO: remove this check with matrix type is deprecated
|
71 | 88 | use_numpy_matrix(True)
|
@@ -101,6 +118,17 @@ def testGramWc(self):
|
101 | 118 | Wc = gram(sys, 'c', return_type=np.ndarray)
|
102 | 119 | np.testing.assert_array_almost_equal(Wc, Wctrue)
|
103 | 120 |
|
| 121 | + # This test only works in Python 3 due to a conflict with the same |
| 122 | + # warning type in other test modules (frd_test.py). See |
| 123 | + # https://bugs.python.org/issue4180 for more details |
| 124 | + @unittest.skipIf(pysys.version_info < (3, 0) or not slycot_check(), |
| 125 | + "test requires Python 3+ and slycot") |
| 126 | + def test_gram_wc_deprecated(self): |
| 127 | + A = np.array([[1., -2.], [3., -4.]]) |
| 128 | + B = np.array([[5., 6.], [7., 8.]]) |
| 129 | + C = np.array([[4., 5.], [6., 7.]]) |
| 130 | + D = np.array([[13., 14.], [15., 16.]]) |
| 131 | + sys = ss(A, B, C, D) |
104 | 132 | # Check that default type generates a warning
|
105 | 133 | # TODO: remove this check with matrix type is deprecated
|
106 | 134 | use_numpy_matrix(True)
|
|
0 commit comments