Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/os-blas-test-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ jobs:
unset | Generic | Apple ) ;; # Found in system
OpenBLAS )
brew install openblas
echo "BLAS_ROOT=/usr/local/opt/openblas/" >> $GITHUB_ENV
echo "LAPACK_ROOT=/usr/local/opt/openblas/" >> $GITHUB_ENV
echo "LDFLAGS=-L/opt/homebrew/opt/openblas/lib" >> $GITHUB_ENV
echo "CPPFLAGS=-I/opt/homebrew/opt/openblas/include" >> $GITHUB_ENV
;;
*)
echo "bla_vendor option ${{ matrix.bla_vendor }} not supported"
Expand Down Expand Up @@ -204,8 +204,6 @@ jobs:
path: slycot-src
- name: Checkout python-control
uses: actions/checkout@v3
with:
repository: 'python-control/python-control'
- name: Setup Python
uses: actions/setup-python@v4
with:
Expand Down
21 changes: 10 additions & 11 deletions control/tests/nyquist_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,17 @@ def test_nyquist_basic():
# Nyquist plot with poles on imaginary axis, omega specified
# (can miss encirclements due to the imaginary poles at +/- 1j)
sys = ct.tf([1], [1, 3, 2]) * ct.tf([1], [1, 0, 1])
with pytest.warns(UserWarning, match="does not match") as records:
with warnings.catch_warnings(record=True) as records:
count = ct.nyquist_response(sys, np.linspace(1e-3, 1e1, 1000))
if len(records) == 0:
assert _Z(sys) == count + _P(sys)

# Nyquist plot with poles on imaginary axis, omega specified, with contour
sys = ct.tf([1], [1, 3, 2]) * ct.tf([1], [1, 0, 1])
with pytest.warns(UserWarning, match="does not match") as records:
count, contour = ct.nyquist_response(
sys, np.linspace(1e-3, 1e1, 1000), return_contour=True)
if len(records) == 0:
assert _Z(sys) == count + _P(sys)
if len(records) == 0:
# No warnings (it happens) => make sure count is correct
assert _Z(sys) == count + _P(sys)
elif len(records) == 1:
# Expected case: make sure warning is the right one
assert issubclass(records[0].category, UserWarning)
assert "encirclements does not match" in str(records[0].message)
else:
pytest.fails("multiple warnings in nyquist_response (?)")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pytest.fails("multiple warnings in nyquist_response (?)")
pytest.fail("multiple warnings in nyquist_response (?)")

https://docs.pytest.org/en/stable/reference/reference.html#pytest-fail


# Nyquist plot with poles on imaginary axis, return contour
sys = ct.tf([1], [1, 3, 2]) * ct.tf([1], [1, 0, 1])
Expand Down