Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d5156e5
Lint: remove unused variables, or prefix with `_`
roryyorke Feb 9, 2025
2a18331
Remove unused imports
roryyorke Feb 9, 2025
1bc0119
Remove imports needed for `eval`
roryyorke Feb 16, 2025
df756eb
Fix incorrect variable names in f-strings
roryyorke Feb 15, 2025
48d6195
Apply ruff checks to control/tests/
roryyorke Feb 16, 2025
20f4b76
Remove unused variable fail_if_missing in test_parameter_docs
roryyorke Feb 16, 2025
3729d89
Remove unused obj and objname in test_iosys_attribute_lists
roryyorke Feb 16, 2025
36d5e8a
Remove unused variable docstring in test_iosys_container_classes
roryyorke Feb 16, 2025
7fe9d4e
Import numpy for symbol np.array
roryyorke Feb 16, 2025
ba33c21
Remove ineffective testFeedback2 in frd_test.py
roryyorke Feb 16, 2025
2156adf
Add assertion in testUnwrap in matlab_test
roryyorke Feb 16, 2025
69afb82
Remove unused steady-state output variable
roryyorke Feb 16, 2025
4e0b9c1
Mark unused test function with noqa
roryyorke Feb 16, 2025
3654163
Merge remote-tracking branch 'upstream/main' into lint-tests
roryyorke Feb 16, 2025
2d5738a
Fix bugs and lint errors in test_timeresp_aliases
roryyorke Feb 16, 2025
fb0519c
Correct use of slycotonly in statesp_test.py
roryyorke Feb 16, 2025
c6d26f1
Remove unused ss_{siso,mimo} variables
roryyorke Feb 16, 2025
22db2bf
Don't use keyword args for eval
roryyorke Feb 16, 2025
5ff3c0c
Handle deprecation warnings from conda setup in Github actions
roryyorke Feb 16, 2025
51eb00a
Remove redundant kwarg test entries
roryyorke Feb 16, 2025
e29ba64
Add assertion to check result of markov call
roryyorke Feb 16, 2025
ff4d7b6
Remove unused variables in test_optimal_doc
roryyorke Feb 16, 2025
870fa19
Merge remote-tracking branch 'upstream/main' into lint-tests
roryyorke Feb 16, 2025
c907a4f
Revert "Handle deprecation warnings from conda setup in Github actions"
roryyorke Feb 16, 2025
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
Prev Previous commit
Next Next commit
Correct use of slycotonly in statesp_test.py
slycontonly is not a fixture.
  • Loading branch information
roryyorke committed Feb 16, 2025
commit fb0519cd2a7347dc8effaf3ba6fc17b7c0aec878
29 changes: 16 additions & 13 deletions control/tests/statesp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from control.statesp import StateSpace, _convert_to_statespace, \
_rss_generate, _statesp_defaults, drss, linfnorm, rss, ss, tf2ss
from control.xferfcn import TransferFunction, ss2tf
from .conftest import assert_tf_close_coeff
from .conftest import assert_tf_close_coeff, slycotonly

class TestStateSpace:
"""Tests for the StateSpace class."""
Expand Down Expand Up @@ -228,7 +228,7 @@ def test_zero_empty(self):
sys = _convert_to_statespace(TransferFunction([1], [1, 2, 1]))
np.testing.assert_array_equal(sys.zeros(), np.array([]))

@pytest.mark.usefixtures("slycotonly")
@slycotonly
def test_zero_siso(self, sys222):
"""Evaluate the zeros of a SISO system."""
# extract only first input / first output system of sys222. This system is denoted sys111
Expand Down Expand Up @@ -258,7 +258,7 @@ def test_zero_mimo_sys222_square(self, sys222):
true_z = np.sort([-10.568501, 3.368501])
np.testing.assert_array_almost_equal(z, true_z)

@pytest.mark.usefixtures("slycotonly")
@slycotonly
def test_zero_mimo_sys623_non_square(self, sys623):
"""Evaluate the zeros of a non square MIMO system."""

Expand Down Expand Up @@ -405,7 +405,7 @@ def test_add_sub_mimo_siso(self):
ss2tf(result).minreal(),
)

@pytest.mark.usefixtures("slycotonly")
@slycotonly
@pytest.mark.parametrize(
"left, right, expected",
[
Expand Down Expand Up @@ -480,7 +480,7 @@ def test_mul_mimo_siso(self, left, right, expected):
ss2tf(result).minreal(),
)

@pytest.mark.usefixtures("slycotonly")
@slycotonly
@pytest.mark.parametrize(
"left, right, expected",
[
Expand Down Expand Up @@ -555,7 +555,7 @@ def test_rmul_mimo_siso(self, left, right, expected):
ss2tf(result).minreal(),
)

@pytest.mark.usefixtures("slycotonly")
@slycotonly
@pytest.mark.parametrize("power", [0, 1, 3, -3])
@pytest.mark.parametrize("sysname", ["sys222", "sys322"])
def test_pow(self, request, sysname, power):
Expand All @@ -574,7 +574,7 @@ def test_pow(self, request, sysname, power):
np.testing.assert_allclose(expected.C, result.C)
np.testing.assert_allclose(expected.D, result.D)

@pytest.mark.usefixtures("slycotonly")
@slycotonly
@pytest.mark.parametrize("order", ["left", "right"])
@pytest.mark.parametrize("sysname", ["sys121", "sys222", "sys322"])
def test_pow_inv(self, request, sysname, order):
Expand All @@ -598,7 +598,7 @@ def test_pow_inv(self, request, sysname, order):
# Check that the output is the same as the input
np.testing.assert_allclose(R.outputs, U)

@pytest.mark.usefixtures("slycotonly")
@slycotonly
def test_truediv(self, sys222, sys322):
"""Test state space truediv"""
for sys in [sys222, sys322]:
Expand All @@ -617,7 +617,7 @@ def test_truediv(self, sys222, sys322):
ss2tf(result).minreal(),
)

@pytest.mark.usefixtures("slycotonly")
@slycotonly
def test_rtruediv(self, sys222, sys322):
"""Test state space rtruediv"""
for sys in [sys222, sys322]:
Expand Down Expand Up @@ -718,7 +718,7 @@ def test_freq_resp(self):
mag, phase, omega = sys.freqresp(true_omega)
np.testing.assert_almost_equal(mag, true_mag)

@pytest.mark.usefixtures("slycotonly")
@slycotonly
def test_minreal(self):
"""Test a minreal model reduction."""
# A = [-2, 0.5, 0; 0.5, -0.3, 0; 0, 0, -0.1]
Expand Down Expand Up @@ -1512,22 +1512,25 @@ def dt_siso(self, request):
name, systype, sysargs, dt, refgpeak, reffpeak = request.param
return ct.c2d(systype(*sysargs), dt), refgpeak, reffpeak

@pytest.mark.usefixtures('slycotonly', 'ignore_future_warning')
@slycotonly
@pytest.mark.usefixtures('ignore_future_warning')
def test_linfnorm_ct_siso(self, ct_siso):
sys, refgpeak, reffpeak = ct_siso
gpeak, fpeak = linfnorm(sys)
np.testing.assert_allclose(gpeak, refgpeak)
np.testing.assert_allclose(fpeak, reffpeak)

@pytest.mark.usefixtures('slycotonly', 'ignore_future_warning')
@slycotonly
@pytest.mark.usefixtures('ignore_future_warning')
def test_linfnorm_dt_siso(self, dt_siso):
sys, refgpeak, reffpeak = dt_siso
gpeak, fpeak = linfnorm(sys)
# c2d pole-mapping has round-off
np.testing.assert_allclose(gpeak, refgpeak)
np.testing.assert_allclose(fpeak, reffpeak)

@pytest.mark.usefixtures('slycotonly', 'ignore_future_warning')
@slycotonly
@pytest.mark.usefixtures('ignore_future_warning')
def test_linfnorm_ct_mimo(self, ct_siso):
siso, refgpeak, reffpeak = ct_siso
sys = ct.append(siso, siso)
Expand Down