@@ -46,7 +46,7 @@ def test_superimpose(self):
46
46
ctrl .bode_plot (ctrl .tf ([5 ], [1 , 1 ]))
47
47
48
48
# Check to make sure there are two axes and that each axes has two lines
49
- assert len (plt .gcf ().axes ) == 2
49
+ self . assertEqual ( len (plt .gcf ().axes ), 2 )
50
50
for ax in plt .gcf ().axes :
51
51
# Make sure there are 2 lines in each subplot
52
52
assert len (ax .get_lines ()) == 2
@@ -56,7 +56,7 @@ def test_superimpose(self):
56
56
ctrl .bode_plot ([ctrl .tf ([1 ], [1 ,2 ,1 ]), ctrl .tf ([5 ], [1 , 1 ])])
57
57
58
58
# Check to make sure there are two axes and that each axes has two lines
59
- assert len (plt .gcf ().axes ) == 2
59
+ self . assertEqual ( len (plt .gcf ().axes ), 2 )
60
60
for ax in plt .gcf ().axes :
61
61
# Make sure there are 2 lines in each subplot
62
62
assert len (ax .get_lines ()) == 2
@@ -68,7 +68,7 @@ def test_superimpose(self):
68
68
ctrl .bode_plot (ctrl .tf ([5 ], [1 , 1 ]))
69
69
70
70
# Check to make sure there are two axes and that each axes has one line
71
- assert len (plt .gcf ().axes ) == 2
71
+ self . assertEqual ( len (plt .gcf ().axes ), 2 )
72
72
for ax in plt .gcf ().axes :
73
73
# Make sure there is only 1 line in the subplot
74
74
assert len (ax .get_lines ()) == 1
@@ -78,7 +78,7 @@ def test_superimpose(self):
78
78
if ax .get_label () == 'control-bode-magnitude' :
79
79
break
80
80
ax .semilogx ([1e-2 , 1e1 ], 20 * np .log10 ([1 , 1 ]), 'k-' )
81
- assert len (ax .get_lines ()) == 2
81
+ self . assertEqual ( len (ax .get_lines ()), 2 )
82
82
83
83
def test_doubleint (self ):
84
84
# 30 May 2016, RMM: added to replicate typecast bug in freqresp.py
@@ -144,9 +144,9 @@ def test_discrete(self):
144
144
omega_bad = np .linspace (10e-4 ,1.1 ,10 ) * np .pi / sys .dt
145
145
ret = sys .freqresp (omega_bad )
146
146
print ("len(w) =" , len (w ))
147
- assert len (w ) == 1
148
- assert "above" in str (w [- 1 ].message )
149
- assert "Nyquist" in str (w [- 1 ].message )
147
+ self . assertEqual ( len (w ), 1 )
148
+ self . assertIn ( "above" , str (w [- 1 ].message ) )
149
+ self . assertIn ( "Nyquist" , str (w [- 1 ].message ) )
150
150
151
151
# Test bode plots (currently only implemented for SISO)
152
152
if (sys .inputs == 1 and sys .outputs == 1 ):
@@ -162,12 +162,7 @@ def test_discrete(self):
162
162
163
163
else :
164
164
# Calling bode should generate a not implemented error
165
- try :
166
- ret_ss = bode (sys )
167
- raise RuntimeError ("MIMO bode seems to be implemented?" )
168
- except NotImplementedError :
169
- # This is where we should end up (so do nothing)
170
- continue
165
+ self .assertRaises (NotImplementedError , bode , (sys ,))
171
166
172
167
def suite ():
173
168
return unittest .TestLoader ().loadTestsFromTestCase (TestTimeresp )
0 commit comments