Skip to content

Commit 5757f2f

Browse files
committed
more careful checking of xfails in optimal_test.py
1 parent 363ea2b commit 5757f2f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

control/tests/optimal_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ def final_point_eval(x, u):
626626
('collocation', 5, 'u0', 'endpoint'),
627627
('collocation', 5, 'input', 'openloop'),# open loop sim fails
628628
('collocation', 10, 'input', None),
629-
('collocation', 10, 'u0', None), # from documenentation
629+
('collocation', 10, 'u0', None), # from documentation
630630
('collocation', 10, 'state', None),
631631
('collocation', 20, 'state', None),
632632
])
@@ -716,9 +716,11 @@ def vehicle_output(t, x, u, params):
716716

717717
# Make sure we started and stopped at the right spot
718718
if fail == 'endpoint':
719+
assert not np.allclose(result.states[:, -1], xf, rtol=1e-4)
719720
pytest.xfail("optimization does not converge to endpoint")
720721
else:
721722
np.testing.assert_almost_equal(result.states[:, 0], x0, decimal=4)
723+
np.testing.assert_almost_equal(result.states[:, -1], xf, decimal=2)
722724

723725
# Simulate the trajectory to make sure it looks OK
724726
resp = ct.input_output_response(

0 commit comments

Comments
 (0)