GeezerVison is showing github.com — Fix CI test and doctest failures with updated NumPy, SciPy, and Matplotlib by murrayrm · Pull Request #1243 · python-control/python-control
Conversation
A collection of small, independent fixes for test and doctest failures
appearing in CI. No functional changes to the library API. Open PRs
with failing CI tests should rebase onto main once this is merged.
NumPy: unsupported shape assignment
ndarray.shape assignment is no longer supported in these contexts;
replaced with reshape().
control/descfcn.py — describing_function()
control/statesp.py — StateSpace.__init__(), static-system reshaping
NumPy: complex-to-real casts
Discard the (numerically zero) imaginary parts explicitly rather than
letting NumPy warn on the implicit cast.
control/modelsimp.py — hankel_singular_values() takes sqrt(w.real),
since Wo @ Wc is symmetric positive semidefinite in exact arithmetic
control/phaseplot.py — separatrices() uses the real part of the
eigenvector, avoiding complex initial conditions
Matplotlib: warning no longer emitted
control/tests/ctrlplot_test.py — drop the pytest.warns(UserWarning, match="Tight layout not applied") check in
test_pole_zero_subplots(), which no longer fires
Platform-dependent numerics
control/tests/nyquist_test.py — test_nyquist_indent_near_imaginary_axis()
now constructs the system with ct.zpk(), placing the poles near the
imaginary axis explicitly instead of relying on the roots of a
polynomial, which gave inconsistent indent signs
control/lti.py, doc/intro.rst — bandwidth() doctests use
# doctest: +ELLIPSIS with ~14 significant digits. The value comes from
a scipy.optimize.root_scalar bisection, so the last digit or two of
the repr varies across SciPy/BLAS builds; the full-precision literals
passed locally but failed on GitHub runners. +ELLIPSIS keeps the
examples verified, unlike the +SKIP used elsewhere for
platform-dependent output, and trim_doctest_flags (on by default)
strips the flag comment from the rendered HTML.
Testing
make doctest in doc/: 728 tests, 0 failures
(Python 3.14.6, NumPy 2.5.1, SciPy 1.18.0).
AI disclosure
Per the AI policy referenced in README.rst: the bandwidth() doctest
change was written with assistance from Claude Code. I have reviewed it
and take responsibility for its content.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
bandwidth() gets its value from a scipy.optimize.root_scalar bisection,
so the last digit or two of the repr differs across scipy/BLAS builds.
The full-precision literals matched locally but failed on GitHub.
Truncate to ~14 significant digits with # doctest: +ELLIPSIS. This
keeps the examples verified (unlike +SKIP, used elsewhere in the repo
for platform-dependent output), and trim_doctest_flags (on by default)
strips the flag comment from the rendered HTML.
Also applied to the G1*G2 example, which has the same origin and had
not failed yet.
Verified with "make doctest" in doc/: 728 tests, 0 failures.
Co-Authored-By: Claude Opus 5 <[email protected]>
|

coverage: 94.74% (+0.2%) from 94.579% — murrayrm:update_tests-08Aug2026 into python-control:main
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Aug 9, 2026
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Aug 9, 2026
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|