Skip to content

Commit 4bba186

Browse files
committed
skip np.matrix warning checks in py2.7 due to bug in repeated warnings
1 parent dc333a6 commit 4bba186

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

control/tests/statefbk_test.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from __future__ import print_function
77
import unittest
8+
import sys as pysys
89
import numpy as np
910
import warnings
1011
from control.statefbk import ctrb, obsv, place, place_varga, lqr, gram, acker
@@ -37,6 +38,14 @@ def testCtrbSISO(self):
3738
np.testing.assert_array_almost_equal(Wc, Wctrue)
3839
self.assertTrue(isinstance(Wc, StateSpaceMatrix))
3940

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+
4049
# Check that default using np.matrix generates a warning
4150
# TODO: remove this check with matrix type is deprecated
4251
use_numpy_matrix(True)
@@ -66,6 +75,14 @@ def testObsvSISO(self):
6675
# Make sure default type values are correct
6776
self.assertTrue(isinstance(Wo, np.ndarray))
6877

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+
6986
# Check that default type generates a warning
7087
# TODO: remove this check with matrix type is deprecated
7188
use_numpy_matrix(True)
@@ -101,6 +118,17 @@ def testGramWc(self):
101118
Wc = gram(sys, 'c', return_type=np.ndarray)
102119
np.testing.assert_array_almost_equal(Wc, Wctrue)
103120

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)
104132
# Check that default type generates a warning
105133
# TODO: remove this check with matrix type is deprecated
106134
use_numpy_matrix(True)

0 commit comments

Comments
 (0)