Skip to content

Commit 3b10af0

Browse files
committed
check for warning the pytest way
1 parent dae8d42 commit 3b10af0

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

control/tests/xferfcn_test.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -474,15 +474,8 @@ def test_call_mimo(self):
474474
def test_freqresp_deprecated(self):
475475
sys = TransferFunction([1., 3., 5], [1., 6., 2., -1.])
476476
# Deprecated version of the call (should generate warning)
477-
import warnings
478-
with warnings.catch_warnings(record=True) as w:
479-
# Set up warnings filter to only show warnings in control module
480-
warnings.filterwarnings("ignore")
481-
warnings.filterwarnings("always", module="control")
482-
483-
# Make sure that we get a pending deprecation warning
477+
with pytest.warns(DeprecationWarning):
484478
sys.freqresp(1.)
485-
assert issubclass(w[-1].category, DeprecationWarning)
486479

487480
def test_frequency_response_siso(self):
488481
"""Evaluate the magnitude and phase of a SISO system at

0 commit comments

Comments
 (0)