def test_opytimizer_update(): space = search.SearchSpace(1, 1, 0, 1) func = function.Function(callable) optimizer = pso.PSO() callbacks = callback.CallbackVessel([]) new_opytimizer = opytimizer.Opytimizer(space, optimizer, func) new_opytimizer.update(callbacks)
def test_callback_vessel_callbacks_setter(): new_callback_vessel = callback.CallbackVessel([]) try: new_callback_vessel.callbacks = 1 except: new_callback_vessel.callbacks = [] assert new_callback_vessel.callbacks == []
def test_callback_vessel(): new_callback_1 = callback.Callback() new_callback_2 = callback.Callback() new_callback_vessel = callback.CallbackVessel( [new_callback_1, new_callback_2]) new_callback_vessel.on_iteration_begin(None, None) new_callback_vessel.on_iteration_end(None, None) new_callback_vessel.on_evaluate_before() new_callback_vessel.on_evaluate_after() new_callback_vessel.on_update_before() new_callback_vessel.on_update_after()
def test_callback_vessel_callbacks(): new_callback_vessel = callback.CallbackVessel([]) assert new_callback_vessel.callbacks == []