File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,11 @@ def test_discrete(self):
141
141
import warnings
142
142
warnings .simplefilter ('always' , UserWarning ) # don't supress
143
143
with warnings .catch_warnings (record = True ) as w :
144
+ # Set up warnings filter to only show warnings in control module
145
+ warnings .filterwarnings ("ignore" )
146
+ warnings .filterwarnings ("always" , module = "control" )
147
+
148
+ # Look for a warning about sampling above Nyquist frequency
144
149
omega_bad = np .linspace (10e-4 ,1.1 ,10 ) * np .pi / sys .dt
145
150
ret = sys .freqresp (omega_bad )
146
151
print ("len(w) =" , len (w ))
Original file line number Diff line number Diff line change @@ -148,7 +148,11 @@ def testEvalFr(self):
148
148
# Deprecated version of the call (should generate warning)
149
149
import warnings
150
150
with warnings .catch_warnings (record = True ) as w :
151
- warnings .simplefilter ("always" )
151
+ # Set up warnings filter to only show warnings in control module
152
+ warnings .filterwarnings ("ignore" )
153
+ warnings .filterwarnings ("always" , module = "control" )
154
+
155
+ # Make sure that we get a pending deprecation warning
152
156
sys .evalfr (1. )
153
157
assert len (w ) == 1
154
158
assert issubclass (w [- 1 ].category , PendingDeprecationWarning )
You can’t perform that action at this time.
0 commit comments