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

tests.test_obj_func_arg   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 20
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A test_argument_0() 0 21 1
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