Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8ee73b9

Browse files
committed
rework nichols_test.py
1 parente4a5180 commit8ee73b9

File tree

1 file changed

+19
-25
lines changed

1 file changed

+19
-25
lines changed

‎control/tests/nichols_test.py

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,28 @@
1-
#!/usr/bin/env python
2-
#
3-
# nichols_test.py - test Nichols plot
4-
# RMM, 31 Mar 2011
1+
"""nichols_test.py - test Nichols plot
52
6-
importunittest
7-
importnumpyasnp
8-
fromcontrol.matlabimport*
3+
RMM, 31 Mar 2011
4+
"""
95

10-
classTestStateSpace(unittest.TestCase):
11-
"""Tests for the Nichols plots."""
6+
importpytest
127

13-
defsetUp(self):
14-
"""Set up a system to test operations on."""
8+
fromcontrolimportStateSpace,nichols_plot,nichols
159

16-
A= [[-3.,4.,2.], [-1.,-3.,0.], [2.,5.,3.]]
17-
B= [[1.], [-3.], [-2.]]
18-
C= [[4.,2.,-3.]]
19-
D= [[0.]]
2010

21-
self.sys=StateSpace(A,B,C,D)
11+
@pytest.fixture()
12+
deftsys():
13+
"""Set up a system to test operations on."""
14+
A= [[-3.,4.,2.], [-1.,-3.,0.], [2.,5.,3.]]
15+
B= [[1.], [-3.], [-2.]]
16+
C= [[4.,2.,-3.]]
17+
D= [[0.]]
18+
returnStateSpace(A,B,C,D)
2219

23-
deftestNicholsPlain(self):
24-
"""Generate a Nichols plot."""
25-
nichols(self.sys)
2620

27-
deftestNgrid(self):
28-
"""Generate a Nichols plot."""
29-
nichols(self.sys,grid=False)
30-
ngrid()
21+
deftest_nichols(tsys,mplcleanup):
22+
"""Generate a Nichols plot."""
23+
nichols_plot(tsys)
3124

3225

33-
if__name__=="__main__":
34-
unittest.main()
26+
deftest_nicholds_alias(tsys,mplcleanup):
27+
"""Test the control.nichols alias and the grid=False parameter"""
28+
nichols(tsys,grid=False)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp