Skip to content

Commit f746081

Browse files
committed
add markers, add test for creating C3 style optim object
1 parent 4fad92e commit f746081

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/test_optim_init.py

+19
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,43 @@
22
"""
33

44
import hjson
5+
import pytest
56

67
from c3.optimizers.c1 import C1
8+
from c3.optimizers.c3 import C3
79
from c3.experiment import Experiment
810
from c3.main import run_cfg
911

1012

13+
@pytest.mark.integration
1114
def test_main_c1() -> None:
1215
with open("test/c1.cfg", "r") as cfg_file:
1316
cfg = hjson.load(cfg_file)
1417
run_cfg(cfg, "test/c1.cfg", debug=True)
1518

1619

20+
@pytest.mark.integration
1721
def test_main_c2() -> None:
1822
with open("test/c2.cfg", "r") as cfg_file:
1923
cfg = hjson.load(cfg_file)
2024
run_cfg(cfg, "test/c2.cfg", debug=True)
2125

2226

27+
@pytest.mark.integration
2328
def test_main_c3() -> None:
2429
with open("test/c3.cfg", "r") as cfg_file:
2530
cfg = hjson.load(cfg_file)
2631
run_cfg(cfg, "test/c3.cfg", debug=True)
2732

2833

34+
@pytest.mark.integration
2935
def test_main_sens() -> None:
3036
with open("test/sensitivity.cfg", "r") as cfg_file:
3137
cfg = hjson.load(cfg_file)
3238
run_cfg(cfg, "test/sensitivity.cfg", debug=True)
3339

3440

41+
@pytest.mark.integration
3542
def test_create_c1() -> None:
3643
with open("test/c1.cfg", "r") as cfg_file:
3744
cfg = hjson.load(cfg_file)
@@ -42,3 +49,15 @@ def test_create_c1() -> None:
4249
exp = Experiment()
4350
exp.read_config(cfg.pop("exp_cfg"))
4451
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

Comments
 (0)