2626import control .tests .statefbk_test as statefbk_test
2727import control .tests .stochsys_test as stochsys_test
2828import control .tests .trdata_test as trdata_test
29+ import control .tests .timeplot_test as timeplot_test
2930
3031@pytest .mark .parametrize ("module, prefix" , [
3132 (control , "" ), (control .flatsys , "flatsys." ), (control .optimal , "optimal." )
@@ -74,7 +75,8 @@ def test_kwarg_search(module, prefix):
7475 # @parametrize messes up the check, but we know it is there
7576 pass
7677
77- elif source and source .find ('unrecognized keyword' ) < 0 :
78+ elif source and source .find ('unrecognized keyword' ) < 0 and \
79+ source .find ('unexpected keyword' ) < 0 :
7880 warnings .warn (
7981 f"'unrecognized keyword' not found in unit test "
8082 f"for { name } " )
@@ -161,7 +163,21 @@ def test_matplotlib_kwargs(function, nsysargs, moreargs, kwargs, mplcleanup):
161163 function (* args , ** kwargs , unknown = None )
162164
163165
166+ @pytest .mark .parametrize (
167+ "function" , [control .time_response_plot , control .TimeResponseData .plot ])
168+ def test_time_response_plot_kwargs (function ):
169+ # Create a system for testing
170+ response = control .step_response (control .rss (4 , 2 , 2 ))
171+
172+ # Call the plotting function normally and make sure it works
173+ function (response )
164174
175+ # Now add an unrecognized keyword and make sure there is an error
176+ with pytest .raises (AttributeError ,
177+ match = "(has no property|unexpected keyword)" ):
178+ function (response , unknown = None )
179+
180+
165181#
166182# List of all unit tests that check for unrecognized keywords
167183#
@@ -185,6 +201,7 @@ def test_matplotlib_kwargs(function, nsysargs, moreargs, kwargs, mplcleanup):
185201 'gangof4_plot' : test_matplotlib_kwargs ,
186202 'input_output_response' : test_unrecognized_kwargs ,
187203 'interconnect' : interconnect_test .test_interconnect_exceptions ,
204+ 'time_response_plot' : timeplot_test .test_errors ,
188205 'linearize' : test_unrecognized_kwargs ,
189206 'lqe' : test_unrecognized_kwargs ,
190207 'lqr' : test_unrecognized_kwargs ,
@@ -230,6 +247,7 @@ def test_matplotlib_kwargs(function, nsysargs, moreargs, kwargs, mplcleanup):
230247 'StateSpace.__init__' : test_unrecognized_kwargs ,
231248 'StateSpace.sample' : test_unrecognized_kwargs ,
232249 'TimeResponseData.__call__' : trdata_test .test_response_copy ,
250+ 'TimeResponseData.plot' : timeplot_test .test_errors ,
233251 'TransferFunction.__init__' : test_unrecognized_kwargs ,
234252 'TransferFunction.sample' : test_unrecognized_kwargs ,
235253 'optimal.OptimalControlProblem.__init__' :
0 commit comments