@@ -46,7 +46,7 @@ def test_superimpose(self):
4646 ctrl .bode_plot (ctrl .tf ([5 ], [1 , 1 ]))
4747
4848 # 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 )
5050 for ax in plt .gcf ().axes :
5151 # Make sure there are 2 lines in each subplot
5252 assert len (ax .get_lines ()) == 2
@@ -56,7 +56,7 @@ def test_superimpose(self):
5656 ctrl .bode_plot ([ctrl .tf ([1 ], [1 ,2 ,1 ]), ctrl .tf ([5 ], [1 , 1 ])])
5757
5858 # 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 )
6060 for ax in plt .gcf ().axes :
6161 # Make sure there are 2 lines in each subplot
6262 assert len (ax .get_lines ()) == 2
@@ -68,7 +68,7 @@ def test_superimpose(self):
6868 ctrl .bode_plot (ctrl .tf ([5 ], [1 , 1 ]))
6969
7070 # 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 )
7272 for ax in plt .gcf ().axes :
7373 # Make sure there is only 1 line in the subplot
7474 assert len (ax .get_lines ()) == 1
@@ -78,7 +78,7 @@ def test_superimpose(self):
7878 if ax .get_label () == 'control-bode-magnitude' :
7979 break
8080 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 )
8282
8383 def test_doubleint (self ):
8484 # 30 May 2016, RMM: added to replicate typecast bug in freqresp.py
@@ -144,9 +144,9 @@ def test_discrete(self):
144144 omega_bad = np .linspace (10e-4 ,1.1 ,10 ) * np .pi / sys .dt
145145 ret = sys .freqresp (omega_bad )
146146 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 ) )
150150
151151 # Test bode plots (currently only implemented for SISO)
152152 if (sys .inputs == 1 and sys .outputs == 1 ):
@@ -162,12 +162,7 @@ def test_discrete(self):
162162
163163 else :
164164 # 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 ,))
171166
172167def suite ():
173168 return unittest .TestLoader ().loadTestsFromTestCase (TestTimeresp )
0 commit comments