Coverage for biobb_pytorch / test / unitests / test_mdae / test_make_plumed.py: 95%

19 statements  

« prev     ^ index     » next       coverage.py v7.13.2, created at 2026-02-02 16:33 +0000

1# type: ignore 

2from biobb_common.tools import test_fixtures as fx 

3from biobb_pytorch.mdae.make_plumed import generatePlumed 

4import os 

5 

6 

7class TestMakePlumed: 

8 def setup_class(self): 

9 fx.test_setup(self, 'generatePlumed') 

10 

11 def teardown_class(self): 

12 fx.test_teardown(self) 

13 

14 def test_generatePlumed(self): 

15 generatePlumed(properties=self.properties, **self.paths) 

16 

17 assert fx.not_empty(self.paths['output_plumed_dat_path']) 

18 assert fx.not_empty(self.paths['output_features_dat_path']) 

19 assert fx.not_empty(self.paths['output_model_ptc_path']) 

20 

21 # Verify PLUMED file contains expected content 

22 with open(self.paths['output_plumed_dat_path'], 'r') as f: 

23 plumed_content = f.read() 

24 assert 'PYTORCH_MODEL' in plumed_content or 'INCLUDE' in plumed_content, "PLUMED file should contain PYTORCH_MODEL or INCLUDE keywords" 

25 

26 # Verify features file exists and is readable 

27 assert os.path.exists(self.paths['output_features_dat_path']), "Features file should exist" 

28 

29 if 'ref_output_plumed_dat_path' in self.paths: 

30 # Compare structure (number of lines, key sections) 

31 assert len(plumed_content.split('\n')) > 0, "PLUMED file should not be empty"