Skip to content

Commit c2bebea

Browse files
committed
fixed incorrect unit test in nyquist_test (OS/BLAS test matrix failure
1 parent b385a9e commit c2bebea

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

control/tests/nyquist_test.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,17 @@ def test_nyquist_basic():
132132
# Nyquist plot with poles on imaginary axis, omega specified
133133
# (can miss encirclements due to the imaginary poles at +/- 1j)
134134
sys = ct.tf([1], [1, 3, 2]) * ct.tf([1], [1, 0, 1])
135-
with pytest.warns(UserWarning, match="does not match") as records:
135+
with warnings.catch_warnings(record=True) as records:
136136
count = ct.nyquist_response(sys, np.linspace(1e-3, 1e1, 1000))
137-
if len(records) == 0:
138-
assert _Z(sys) == count + _P(sys)
137+
if len(records) == 0:
138+
# No warnings (it happens) => make sure count is correct
139+
assert _Z(sys) == count + _P(sys)
140+
elif len(records) == 1:
141+
# Expected case: make sure warning is the right one
142+
assert issubclass(records[0].category, UserWarning)
143+
assert "encirclements does not match" in str(records[0].message)
144+
else:
145+
pytest.fails("multiple warnings in nyquist_response (?)")
139146

140147
# Nyquist plot with poles on imaginary axis, omega specified, with contour
141148
sys = ct.tf([1], [1, 3, 2]) * ct.tf([1], [1, 0, 1])

0 commit comments

Comments
 (0)