2
2
"""
3
3
4
4
import hjson
5
+ import pytest
5
6
6
7
from c3 .optimizers .c1 import C1
8
+ from c3 .optimizers .c3 import C3
7
9
from c3 .experiment import Experiment
8
10
from c3 .main import run_cfg
9
11
10
12
13
+ @pytest .mark .integration
11
14
def test_main_c1 () -> None :
12
15
with open ("test/c1.cfg" , "r" ) as cfg_file :
13
16
cfg = hjson .load (cfg_file )
14
17
run_cfg (cfg , "test/c1.cfg" , debug = True )
15
18
16
19
20
+ @pytest .mark .integration
17
21
def test_main_c2 () -> None :
18
22
with open ("test/c2.cfg" , "r" ) as cfg_file :
19
23
cfg = hjson .load (cfg_file )
20
24
run_cfg (cfg , "test/c2.cfg" , debug = True )
21
25
22
26
27
+ @pytest .mark .integration
23
28
def test_main_c3 () -> None :
24
29
with open ("test/c3.cfg" , "r" ) as cfg_file :
25
30
cfg = hjson .load (cfg_file )
26
31
run_cfg (cfg , "test/c3.cfg" , debug = True )
27
32
28
33
34
+ @pytest .mark .integration
29
35
def test_main_sens () -> None :
30
36
with open ("test/sensitivity.cfg" , "r" ) as cfg_file :
31
37
cfg = hjson .load (cfg_file )
32
38
run_cfg (cfg , "test/sensitivity.cfg" , debug = True )
33
39
34
40
41
+ @pytest .mark .integration
35
42
def test_create_c1 () -> None :
36
43
with open ("test/c1.cfg" , "r" ) as cfg_file :
37
44
cfg = hjson .load (cfg_file )
@@ -42,3 +49,15 @@ def test_create_c1() -> None:
42
49
exp = Experiment ()
43
50
exp .read_config (cfg .pop ("exp_cfg" ))
44
51
C1 (** cfg , pmap = exp .pmap )
52
+
53
+
54
+ @pytest .mark .integration
55
+ def test_create_c3 () -> None :
56
+ with open ("test/c3.cfg" , "r" ) as cfg_file :
57
+ cfg = hjson .load (cfg_file )
58
+ cfg .pop ("optim_type" )
59
+ cfg .pop ("exp_opt_map" )
60
+
61
+ exp = Experiment ()
62
+ exp .read_config (cfg .pop ("exp_cfg" ))
63
+ assert isinstance (C3 (** cfg , pmap = exp .pmap ), C3 )
0 commit comments