@@ -93,6 +93,55 @@ def test_unhandled_info_iwarn():
93
93
assert wm [1 ].message .info == 0
94
94
95
95
96
+ def test_info_standard_i ():
97
+ """Test the handling of standard "`info = -i`
98
+
99
+ Raises
100
+ ------
101
+ SlycotError
102
+ :info = -i: Non-standard msg, info is {info}, -i is -{i}
103
+ """
104
+ # No i in check_vars: keep silent
105
+ raise_if_slycot_error (- 1 , docstring = test_info_standard_i .__doc__ ,
106
+ checkvars = {'a' : 1 })
107
+ # -i does not match
108
+ raise_if_slycot_error (- 1 , docstring = test_info_standard_i .__doc__ ,
109
+ checkvars = {'i' : 2 })
110
+ # -i matches, raise the error
111
+ with pytest .raises (SlycotError ) as ex_info :
112
+ raise_if_slycot_error (- 1 , docstring = test_info_standard_i .__doc__ ,
113
+ checkvars = {'i' : 1 })
114
+ assert str (ex_info .value ) == "\n Non-standard msg, info is -1, -i is -1"
115
+
116
+
117
+ def test_infospec_nameerror ():
118
+ """Test infospec with unknown variable.
119
+
120
+ Raises
121
+ ------
122
+ SlycotError
123
+ :info = v: We do not know {v}
124
+ """
125
+ with pytest .raises (RuntimeError ) as ex_info :
126
+ raise_if_slycot_error (- 1 , docstring = test_infospec_nameerror .__doc__ ,
127
+ checkvars = {'a' : 1 })
128
+ assert str (ex_info .value ) == "Unknown variable in infospec: info = v"
129
+
130
+
131
+ def test_infospec_syntaxerror ():
132
+ """Test invalid infospec.
133
+
134
+ Raises
135
+ ------
136
+ SlycotError
137
+ :info i: Invalid expression
138
+ """
139
+ with pytest .raises (RuntimeError ) as ex_info :
140
+ raise_if_slycot_error (- 1 , docstring = test_infospec_syntaxerror .__doc__ ,
141
+ checkvars = {'i' : 1 })
142
+ assert str (ex_info .value ) == "Invalid infospec: info i"
143
+
144
+
96
145
# Test code for test_xerbla_override
97
146
CODE = """
98
147
import sys
0 commit comments