diff --git a/tests/test_all_test_functions.py b/tests/test_all_test_functions.py index ca70bf0..d079b10 100644 --- a/tests/test_all_test_functions.py +++ b/tests/test_all_test_functions.py @@ -25,7 +25,7 @@ def test_all_mathematical_functions(test_function): hyper = Hyperactive() hyper.add_search( - test_function_, + test_function_.objective_function, test_function_.create_n_dim_search_space(value_types="list"), n_iter=15, ) @@ -38,7 +38,7 @@ def test_all_machine_learning_functions(test_function): hyper = Hyperactive() hyper.add_search( - test_function_, + test_function_.objective_function, test_function_.search_space, n_iter=15, ) diff --git a/tests/test_arrays_input.py b/tests/test_arrays_input.py index ca46743..62ec524 100644 --- a/tests/test_arrays_input.py +++ b/tests/test_arrays_input.py @@ -34,8 +34,8 @@ styblinski_tang_function = StyblinskiTangFunction(2, input_type="arrays") -objective_function_para_2D = ( - "objective_function", +test_function_para_2D = ( + "test_function", [ (sphere_function), (rastrigin_function), @@ -57,6 +57,6 @@ b = np.array([1, 2, 3, 4, 5]) -@pytest.mark.parametrize(*objective_function_para_2D) -def test_array_input(objective_function): - objective_function(a, b) +@pytest.mark.parametrize(*test_function_para_2D) +def test_array_input(test_function): + test_function.objective_function(a, b) diff --git a/tests/test_optimization.py b/tests/test_optimization.py index 57938c1..9fa94e6 100644 --- a/tests/test_optimization.py +++ b/tests/test_optimization.py @@ -36,7 +36,7 @@ objective_function_para_2D = ( - "objective_function", + "test_function", [ (sphere_function), (rastrigin_function), @@ -57,14 +57,14 @@ @pytest.mark.parametrize(*objective_function_para_2D) -def test_optimization_2D(objective_function): +def test_optimization_2D(test_function): search_space = { "x0": np.arange(0, 100, 1), "x1": np.arange(0, 100, 1), } opt = RandomSearchOptimizer(search_space) - opt.search(objective_function, n_iter=30) + opt.search(test_function.objective_function, n_iter=30) ############################################################ @@ -75,7 +75,7 @@ def test_optimization_2D(objective_function): objective_function_para_3D = ( - "objective_function", + "test_function", [ (sphere_function), (rastrigin_function), @@ -85,7 +85,7 @@ def test_optimization_2D(objective_function): @pytest.mark.parametrize(*objective_function_para_3D) -def test_optimization_3D(objective_function): +def test_optimization_3D(test_function): search_space = { "x0": np.arange(0, 100, 1), "x1": np.arange(0, 100, 1), @@ -93,7 +93,7 @@ def test_optimization_3D(objective_function): } opt = RandomSearchOptimizer(search_space) - opt.search(objective_function, n_iter=30) + opt.search(test_function.objective_function, n_iter=30) ############################################################ @@ -104,7 +104,7 @@ def test_optimization_3D(objective_function): objective_function_para_4D = ( - "objective_function", + "test_function", [ (sphere_function), (rastrigin_function), @@ -114,7 +114,7 @@ def test_optimization_3D(objective_function): @pytest.mark.parametrize(*objective_function_para_4D) -def test_optimization_4D(objective_function): +def test_optimization_4D(test_function): search_space = { "x0": np.arange(0, 100, 1), "x1": np.arange(0, 100, 1), @@ -123,4 +123,4 @@ def test_optimization_4D(objective_function): } opt = RandomSearchOptimizer(search_space) - opt.search(objective_function, n_iter=30) + opt.search(test_function.objective_function, n_iter=30)