From 29eaa2ca94fbf45333b7030e64b318b03f396059 Mon Sep 17 00:00:00 2001 From: Peter Stahlecker Date: Tue, 21 Jan 2025 17:34:14 +0100 Subject: [PATCH] changed test function to np.allclose as per suggerstion --- opty/tests/test_direct_collocation.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/opty/tests/test_direct_collocation.py b/opty/tests/test_direct_collocation.py index ec4e37f..1a07414 100644 --- a/opty/tests/test_direct_collocation.py +++ b/opty/tests/test_direct_collocation.py @@ -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 @@ -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))