Skip to content

Commit

Permalink
changed test function to np.allclose as per suggerstion
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter230655 committed Jan 21, 2025
1 parent e7a22b2 commit 29eaa2c
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions opty/tests/test_direct_collocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1647,10 +1647,9 @@ def obj_grad(free):
len(state_symbols), len(control_symbols), num_nodes)

states, controls, constants = prob.parse_free(initial_guess)
assert(np.all(states == statesu))
assert(np.all(controls == controlsu))
assert(np.all(constants == constantsu))

assert(np.allclose(states, statesu))
assert(np.allclose(controls, controlsu))
assert(np.allclose(constants, constantsu))

# test with variable interval_value
interval_value = h
Expand Down Expand Up @@ -1684,7 +1683,7 @@ def obj_grad(free):
num_nodes, variable_duration=True)

states, controls, constants, times = prob.parse_free(initial_guess)
assert(np.all(states == statesu))
assert(np.all(controls == controlsu))
assert(np.all(constants == constantsu))
assert(np.all(timeu == times))
assert(np.allclose(states, statesu))
assert(np.allclose(controls, controlsu))
assert(np.allclose(constants, constantsu))
assert(np.allclose(timeu, times))

0 comments on commit 29eaa2c

Please sign in to comment.