Skip to content

Commit b44d5ba

Browse files
committed
address final (?) @slivingston comments
1 parent 996211c commit b44d5ba

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

control/tests/config_test.py

+19-3
Original file line numberDiff line numberDiff line change
@@ -320,14 +320,30 @@ def test_system_indexing(self):
320320
sys2 = sys[1:, 1:]
321321
assert sys2.name == 'PRE' + sys.name + 'POST'
322322

323-
def test_repr_format(self):
323+
@pytest.mark.parametrize("kwargs", [
324+
{},
325+
{'name': 'mysys'},
326+
{'inputs': 1},
327+
{'inputs': 'u'},
328+
{'outputs': 1},
329+
{'outputs': 'y'},
330+
{'states': 1},
331+
{'states': 'x'},
332+
{'inputs': 1, 'outputs': 'y', 'states': 'x'},
333+
{'dt': 0.1}
334+
])
335+
def test_repr_format(self, kwargs):
324336
from ..statesp import StateSpace
325337
from numpy import array
326338

327-
sys = ct.ss([[1]], [[1]], [[1]], [[0]])
339+
sys = ct.ss([[1]], [[1]], [[1]], [[0]], **kwargs)
328340
new = eval(repr(sys))
329341
for attr in ['A', 'B', 'C', 'D']:
330-
assert getattr(sys, attr) == getattr(sys, attr)
342+
assert getattr(new, attr) == getattr(sys, attr)
343+
for prop in ['input_labels', 'output_labels', 'state_labels']:
344+
assert getattr(new, attr) == getattr(sys, attr)
345+
if 'name' in kwargs:
346+
assert new.name == sys.name
331347

332348

333349
def test_config_context_manager():

control/tests/iosys_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2351,7 +2351,7 @@ def test_iosys_repr(fcn, spec, expected, missing, format):
23512351
sys.repr_format = format
23522352
out = repr(sys)
23532353
if format == 'eval':
2354-
assert re.search(expected, out) != None
2354+
assert re.search(expected, out) is not None
23552355

23562356
if missing is not None:
23572357
assert re.search(missing, out) is None

examples/repr_gallery.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"source": [
88
"# System Representation Gallery\n",
99
"\n",
10-
"This Jupyter notebook creates different types of systems and generates a variety of representations (`__repr__`, `__str__`) for those systems that can be used to compare different versions of python-control. It is mainly intended for uses by developers to make sure there are no unexpected changes in representation formats, but also has some interest examples of different choices in system representation."
10+
"This Jupyter notebook creates different types of systems and generates a variety of representations (`__repr__`, `__str__`) for those systems that can be used to compare different versions of python-control. It is mainly intended for uses by developers to make sure there are no unexpected changes in representation formats, but also has some interesting examples of different choices in system representation."
1111
]
1212
},
1313
{

0 commit comments

Comments
 (0)