Skip to content

Commit 8ee73b9

Browse files
committed
rework nichols_test.py
1 parent e4a5180 commit 8ee73b9

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-
import unittest
7-
import numpy as np
8-
from control.matlab import *
3+
RMM, 31 Mar 2011
4+
"""
95

10-
class TestStateSpace(unittest.TestCase):
11-
"""Tests for the Nichols plots."""
6+
import pytest
127

13-
def setUp(self):
14-
"""Set up a system to test operations on."""
8+
from control import StateSpace, 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+
def tsys():
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+
return StateSpace(A, B, C, D)
2219

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

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

3225

33-
if __name__ == "__main__":
34-
unittest.main()
26+
def test_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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy