Code Duplication    Length = 19-20 lines in 3 locations

tests/test_search_spaces.py 3 locations

@@ 54-73 (lines=20) @@
51
    assert hyper.best_para(objective_function)["x1"] in search_space["x1"]
52
53
54
def test_search_space_2():
55
    def objective_function(opt):
56
        score = -opt["x1"] * opt["x1"]
57
        return score
58
59
    search_space = {
60
        "x1": list(range(0, 100, 1)),
61
        "str1": ["0", "1", "2"],
62
    }
63
64
    hyper = Hyperactive()
65
    hyper.add_search(
66
        objective_function,
67
        search_space,
68
        n_iter=15,
69
    )
70
    hyper.run()
71
72
    assert isinstance(hyper.search_data(objective_function), pd.DataFrame)
73
    assert hyper.best_para(objective_function)["str1"] in search_space["str1"]
74
75
76
def test_search_space_3():
@@ 33-51 (lines=19) @@
30
    assert hyper.best_para(objective_function)["x1"] in search_space["x1"]
31
32
33
def test_search_space_1():
34
    def objective_function(opt):
35
        score = -opt["x1"] * opt["x1"]
36
        return score
37
38
    search_space = {
39
        "x1": list(np.arange(0, 0.003, 0.001)),
40
    }
41
42
    hyper = Hyperactive()
43
    hyper.add_search(
44
        objective_function,
45
        search_space,
46
        n_iter=15,
47
    )
48
    hyper.run()
49
50
    assert isinstance(hyper.search_data(objective_function), pd.DataFrame)
51
    assert hyper.best_para(objective_function)["x1"] in search_space["x1"]
52
53
54
def test_search_space_2():
@@ 12-30 (lines=19) @@
9
    pytest.skip("skip these tests for windows", allow_module_level=True)
10
11
12
def test_search_space_0():
13
    def objective_function(opt):
14
        score = -opt["x1"] * opt["x1"]
15
        return score
16
17
    search_space = {
18
        "x1": list(range(0, 3, 1)),
19
    }
20
21
    hyper = Hyperactive()
22
    hyper.add_search(
23
        objective_function,
24
        search_space,
25
        n_iter=15,
26
    )
27
    hyper.run()
28
29
    assert isinstance(hyper.search_data(objective_function), pd.DataFrame)
30
    assert hyper.best_para(objective_function)["x1"] in search_space["x1"]
31
32
33
def test_search_space_1():