Passed
Push — master ( 82a436...3434da )
by Simon
02:00
created

tests.test_obj_func_arg.test_argument_0()   A

Complexity

Conditions 1

Size

Total Lines 21
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 15
nop 0
dl 0
loc 21
rs 9.65
c 0
b 0
f 0
1
import numpy as np
2
from hyperactive import Hyperactive
3
4
5
search_space = {
6
    "x1": list(np.arange(0, 100, 1)),
7
}
8
9
10
def test_argument_0():
11
    def objective_function(para):
12
13
        print("\npara.nth_iter", para.nth_iter)
14
        print("nth_iter_local", para.pass_through["nth_iter_local"])
15
16
        assert para.nth_iter == para.pass_through["nth_iter_local"]
17
18
        para.pass_through["nth_iter_local"] += 1
19
20
        return 0
21
22
    hyper = Hyperactive()
23
    hyper.add_search(
24
        objective_function,
25
        search_space,
26
        n_iter=100,
27
        pass_through={"nth_iter_local": 0},
28
        memory=False,
29
    )
30
    hyper.run()
31