Coverage for biobb_haddock/test/unitests/test_haddock/test_common.py: 100%
26 statements
« prev ^ index » next coverage.py v7.10.2, created at 2025-08-07 08:48 +0000
« prev ^ index » next coverage.py v7.10.2, created at 2025-08-07 08:48 +0000
1# type: ignore
2from biobb_common.tools import test_fixtures as fx
3from biobb_haddock.haddock.common import create_cfg
4import toml
7class TestCreateCfg():
8 def setup_class(self):
9 fx.test_setup(self, 'common')
11 def teardown_class(self):
12 pass
13 # fx.test_teardown(self)
15 def test_create_cfg_step(self):
16 create_cfg(
17 output_cfg_path=str(self.paths['output_cfg']),
18 workflow_dict={'haddock_step_name': 'topoaa',
19 'run_dir': 'test_dir'},
20 input_cfg_path=self.paths['input_cfg_step'],
21 cfg_properties_dict=self.properties['cfg_step'],
22 )
24 assert fx.not_empty(self.paths['output_cfg'])
25 with open(self.paths['output_cfg'], 'r') as f:
26 cfg = toml.loads(f.read())
28 assert cfg['run_dir'] == 'test_dir' # From workflow_dict
29 assert cfg['topoaa.1']['iniseed'] == 1 # From input_cfg
30 assert cfg['topoaa.1']['tolerance'] == 5 # From cfg_properties_dict
31 assert cfg['topoaa.1']["log_level"] == "quiet" # From preset
33 def test_create_cfg_run(self):
34 create_cfg(
35 output_cfg_path=str(self.paths['output_cfg']),
36 workflow_dict={'run_dir': 'test_dir',
37 'ambig_restraints_table_path': 'test_tbl'},
38 input_cfg_path=self.paths['input_cfg_run'],
39 cfg_properties_dict=self.properties['cfg_run'],
40 )
42 assert fx.not_empty(self.paths['output_cfg'])
43 with open(self.paths['output_cfg'], 'r') as f:
44 cfg = toml.loads(f.read())
46 assert cfg['run_dir'] == 'test_dir' # From workflow_dict
47 assert cfg['topoaa.1']['iniseed'] == 1 # From input_cfg
48 assert cfg['topoaa.1']['tolerance'] == 5 # From cfg_properties_dict
49 assert cfg['rigidbody.1']['ambig_fname'] == 'test_tbl'