Skip to content

Commit 7e852fd

Browse files
committed
move StateSpace generation into test function
1 parent aacb648 commit 7e852fd

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

control/tests/statesp_test.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -869,15 +869,15 @@ def test_statespace_defaults(self, matarrayout):
869869

870870

871871
# test data for test_latex_repr below
872-
LTX_G1 = StateSpace([[np.pi, 1e100], [-1.23456789, 5e-23]],
873-
[[0], [1]],
874-
[[987654321, 0.001234]],
875-
[[5]])
872+
LTX_G1 = ([[np.pi, 1e100], [-1.23456789, 5e-23]],
873+
[[0], [1]],
874+
[[987654321, 0.001234]],
875+
[[5]])
876876

877-
LTX_G2 = StateSpace([],
878-
[],
879-
[],
880-
[[1.2345, -2e-200], [-1, 0]])
877+
LTX_G2 = ([],
878+
[],
879+
[],
880+
[[1.2345, -2e-200], [-1, 0]])
881881

882882
LTX_G1_REF = {
883883
'p3_p' : '\\[\n\\left(\n\\begin{array}{rllrll|rll}\n3.&\\hspace{-1em}14&\\hspace{-1em}\\phantom{\\cdot}&1\\phantom{.}&\\hspace{-1em}&\\hspace{-1em}\\cdot10^{100}&0\\phantom{.}&\\hspace{-1em}&\\hspace{-1em}\\phantom{\\cdot}\\\\\n-1.&\\hspace{-1em}23&\\hspace{-1em}\\phantom{\\cdot}&5\\phantom{.}&\\hspace{-1em}&\\hspace{-1em}\\cdot10^{-23}&1\\phantom{.}&\\hspace{-1em}&\\hspace{-1em}\\phantom{\\cdot}\\\\\n\\hline\n9.&\\hspace{-1em}88&\\hspace{-1em}\\cdot10^{8}&0.&\\hspace{-1em}00123&\\hspace{-1em}\\phantom{\\cdot}&5\\phantom{.}&\\hspace{-1em}&\\hspace{-1em}\\phantom{\\cdot}\\\\\n\\end{array}\\right)\n\\]',
@@ -903,12 +903,12 @@ def test_statespace_defaults(self, matarrayout):
903903
refkey_r = {None: 'p', 'partitioned': 'p', 'separate': 's'}
904904

905905

906-
@pytest.mark.parametrize(" g, ref",
906+
@pytest.mark.parametrize(" gmats, ref",
907907
[(LTX_G1, LTX_G1_REF),
908908
(LTX_G2, LTX_G2_REF)])
909909
@pytest.mark.parametrize("repr_type", [None, "partitioned", "separate"])
910910
@pytest.mark.parametrize("num_format", [None, ".3g", ".5g"])
911-
def test_latex_repr(g, ref, repr_type, num_format, editsdefaults):
911+
def test_latex_repr(gmats, ref, repr_type, num_format, editsdefaults):
912912
"""Test `._latex_repr_` with different config values
913913
914914
This is a 'gold image' test, so if you change behaviour,
@@ -924,6 +924,7 @@ def test_latex_repr(g, ref, repr_type, num_format, editsdefaults):
924924
if repr_type is not None:
925925
set_defaults('statesp', latex_repr_type=repr_type)
926926

927+
g = StateSpace(*gmats)
927928
refkey = "{}_{}".format(refkey_n[num_format], refkey_r[repr_type])
928929
assert g._repr_latex_() == ref[refkey]
929930

0 commit comments

Comments
 (0)