From 70bf20754cfc323df7914c983ea89cd37154dc50 Mon Sep 17 00:00:00 2001 From: Richard Murray Date: Sun, 29 Jul 2018 14:30:06 -0700 Subject: [PATCH 1/2] update statesp_test.py unit test to fix numpy warnings --- control/tests/statesp_test.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/control/tests/statesp_test.py b/control/tests/statesp_test.py index 35f511ab1..3e9adcca6 100644 --- a/control/tests/statesp_test.py +++ b/control/tests/statesp_test.py @@ -148,7 +148,11 @@ def testEvalFr(self): # Deprecated version of the call (should generate warning) import warnings with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always") + # Set up warnings filter to only show warnings in control module + warnings.filterwarnings("ignore") + warnings.filterwarnings("always", module="control") + + # Make sure that we get a pending deprecation warning sys.evalfr(1.) assert len(w) == 1 assert issubclass(w[-1].category, PendingDeprecationWarning) From 53e0a092377fc8a181016f732f94f7c26871443a Mon Sep 17 00:00:00 2001 From: Richard Murray Date: Sun, 29 Jul 2018 14:47:51 -0700 Subject: [PATCH 2/2] update freqresp_test.py unit test to fix numpy warnings --- control/tests/freqresp_test.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/control/tests/freqresp_test.py b/control/tests/freqresp_test.py index a6fc49a7f..609a91e8f 100644 --- a/control/tests/freqresp_test.py +++ b/control/tests/freqresp_test.py @@ -141,6 +141,11 @@ def test_discrete(self): import warnings warnings.simplefilter('always', UserWarning) # don't supress with warnings.catch_warnings(record=True) as w: + # Set up warnings filter to only show warnings in control module + warnings.filterwarnings("ignore") + warnings.filterwarnings("always", module="control") + + # Look for a warning about sampling above Nyquist frequency omega_bad = np.linspace(10e-4,1.1,10) * np.pi/sys.dt ret = sys.freqresp(omega_bad) print("len(w) =", len(w))