Skip to content

Commit f3d46bc

Browse files
committed
rebase cleanup
1 parent b2e86b8 commit f3d46bc

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

control/optimal.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
import logging
1717
import time
1818

19-
from .timeresp import TimeResponseData
2019
from . import config
20+
from .exception import ControlNotImplemented
21+
from .timeresp import TimeResponseData
2122

2223
__all__ = ['find_optimal_input']
2324

@@ -155,11 +156,7 @@ def __init__(
155156

156157
# Make sure all input arguments got parsed
157158
if kwargs:
158-
raise TypeError("unknown parameters %s" % kwargs)
159-
160-
if len(kwargs) > 0:
161-
raise ValueError(
162-
f'unrecognized keyword(s): {list(kwargs.keys())}')
159+
raise TypeError("unrecognized keyword(s): ", str(kwargs))
163160

164161
# Process trajectory constraints
165162
if isinstance(trajectory_constraints, tuple):
@@ -997,16 +994,12 @@ def solve_ocp(
997994
# Process keyword arguments
998995
if trajectory_constraints is None:
999996
# Backwards compatibility
1000-
trajectory_constraints = kwargs.pop('constraints', None)
997+
trajectory_constraints = kwargs.pop('constraints', [])
1001998

1002999
# Allow 'return_x` as a synonym for 'return_states'
10031000
return_states = ct.config._get_param(
10041001
'optimal', 'return_x', kwargs, return_states, pop=True)
10051002

1006-
# Process terminal constraints keyword
1007-
if constraints is None:
1008-
constraints = kwargs.pop('trajectory_constraints', [])
1009-
10101003
# Process (legacy) method keyword
10111004
if kwargs.get('method'):
10121005
if kwargs.get('minimize_method'):

control/tests/optimal_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ def test_ocp_argument_errors():
455455
sys, time, x0, cost, constraints, initial_guess=np.zeros((4,1,1)))
456456

457457
# Unrecognized arguments
458-
with pytest.raises(ValueError, match="unrecognized keyword"):
458+
with pytest.raises(TypeError, match="unrecognized keyword"):
459459
res = opt.solve_ocp(
460460
sys, time, x0, cost, constraints, terminal_constraint=None)
461461

0 commit comments

Comments
 (0)