Skip to content

Commit b5925c3

Browse files
committed
unit test
1 parent 4e96553 commit b5925c3

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

control/tests/interconnect_test.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,24 @@ def test_interconnect_docstring():
201201
np.testing.assert_almost_equal(T.C @ T. A @ T.B, T_ss.C @ T_ss.A @ T_ss.B)
202202
np.testing.assert_almost_equal(T.D, T_ss.D)
203203

204+
def test_signal_table(capsys):
205+
P = ct.ss(1,1,1,0, inputs='u', outputs='y')
206+
C = ct.tf(10, [.1, 1], inputs='e', outputs='u')
207+
L = ct.interconnect([C, P], inputs='e', outputs='y')
208+
L.signal_table()
209+
captured = capsys.readouterr().out
210+
211+
# break the following strings separately because the printout order varies
212+
# because signals are stored as a dict
213+
mystrings = \
214+
["signal | source | destination",
215+
"-------------------------------------------------------------",
216+
"e | input | system 0",
217+
"u | system 0 | system 1",
218+
"y | system 1 | output"]
219+
220+
for str_ in mystrings:
221+
assert str_ in captured
204222

205223
def test_interconnect_exceptions():
206224
# First make sure the docstring example works

0 commit comments

Comments
 (0)