Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5e16344
reorganize travis matrix, extend conftest.py
bnavigator Dec 29, 2020
c220a98
pytestify bdalg_test
bnavigator Dec 29, 2020
90a0059
pytestify canonical_test
bnavigator Jul 26, 2020
79b5bfe
pytestify config_test
bnavigator Dec 29, 2020
74d563c
pytestify convert_test.py
bnavigator Jul 24, 2020
c7cc828
pytestify ctrlutil_test
bnavigator Jul 24, 2020
d899140
pytestify delay_test.py
bnavigator Jul 24, 2020
53520e9
pytestify discrete_test
bnavigator Aug 19, 2020
659aa2d
pytestify flatsys_test
bnavigator Dec 29, 2020
1da4c5c
pytestify frd_test
bnavigator Jul 24, 2020
96f0911
pytestify freqresp_test.py
bnavigator Dec 29, 2020
caed712
pytestify input_element_int_test
bnavigator Jul 26, 2020
55a6119
pytestify iosys_test
bnavigator Dec 29, 2020
521e927
pytestify lti_test.py
bnavigator Jul 26, 2020
2c31029
pytestify mateqn_test
bnavigator Dec 29, 2020
fc2f770
pytestify matlab tests
bnavigator Jul 26, 2020
5880473
pytestify minreal_test
bnavigator Jul 26, 2020
97eedaf
pytestify modelsimp
bnavigator Dec 29, 2020
3eb0a92
pytestify nichols_test
bnavigator Jul 26, 2020
000998f
pytestify phaseplot_test
bnavigator Jul 28, 2020
3177796
pytestify rlocus_test.py
bnavigator Jul 28, 2020
f745bd2
pytestify robust tests
bnavigator Dec 29, 2020
2ee0773
pytestify sisotool_test.py
bnavigator Dec 29, 2020
e660363
pytestify slycot_convert_test.py
bnavigator Jul 28, 2020
952c511
pytestify statefbk tests
bnavigator Dec 29, 2020
6386832
pytestify statesp tests
bnavigator Dec 29, 2020
1dd2525
pytestify timeresp_test.py
bnavigator Dec 29, 2020
29883e8
pytestify xferfcn_input_test.py
bnavigator Jul 31, 2020
ca9476f
pytestify xferfcn tests
bnavigator Dec 29, 2020
2b98769
make tests work with pre #431 source code state
bnavigator Dec 29, 2020
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
pytestify sisotool_test.py
  • Loading branch information
bnavigator committed Dec 29, 2020
commit 2ee0773436a6dfb6b60b3afb5f2c81f937734be0
32 changes: 16 additions & 16 deletions control/tests/sisotool_test.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
import unittest
"""sisotool_test.py"""

import matplotlib.pyplot as plt
import numpy as np
from numpy.testing import assert_array_almost_equal
import pytest

from control.sisotool import sisotool
from control.rlocus import _RLClickDispatcher
from control.xferfcn import TransferFunction


class TestSisotool(unittest.TestCase):
@pytest.mark.usefixtures("mplcleanup")
class TestSisotool:
"""These are tests for the sisotool in sisotool.py."""

def setUp(self):
# One random SISO system.
self.system = TransferFunction([1000], [1, 25, 100, 0])
@pytest.fixture
def sys(self):
"""Return a generic SISO transfer function"""
return TransferFunction([1000], [1, 25, 100, 0])

def test_sisotool(self):
sisotool(self.system, Hz=False)
def test_sisotool(self, sys):
sisotool(sys, Hz=False)
fig = plt.gcf()
ax_mag, ax_rlocus, ax_phase, ax_step = fig.axes[:4]

Expand Down Expand Up @@ -57,7 +61,7 @@ def test_sisotool(self):
event = type('test', (object,), {'xdata': 2.31206868287,
'ydata': 15.5983051046,
'inaxes': ax_rlocus.axes})()
_RLClickDispatcher(event=event, sys=self.system, fig=fig,
_RLClickDispatcher(event=event, sys=sys, fig=fig,
ax_rlocus=ax_rlocus, sisotool=True, plotstr='-',
bode_plot_params=bode_plot_params, tvect=None)

Expand All @@ -82,13 +86,9 @@ def test_sisotool(self):
# Check if the step response has changed
# new array needed because change in compute step response default time
step_response_moved = np.array(
[0. , 0.0072, 0.0516, 0.1554, 0.3281, 0.5681, 0.8646, 1.1987,
1.5452, 1.875 ])
#old: array([0., 0.0239, 0.161 , 0.4547, 0.8903, 1.407,
# 1.9121, 2.2989, 2.4686, 2.353])
[0., 0.0072, 0.0516, 0.1554, 0.3281, 0.5681, 0.8646, 1.1987,
1.5452, 1.875])
# old: array([0., 0.0239, 0.161 , 0.4547, 0.8903, 1.407,
# 1.9121, 2.2989, 2.4686, 2.353])
assert_array_almost_equal(
ax_step.lines[0].get_data()[1][:10], step_response_moved, 4)


if __name__ == "__main__":
unittest.main()