Coverage for biobb_pytorch / test / unitests / test_mdae / test_feat2traj.py: 90%
20 statements
« prev ^ index » next coverage.py v7.13.2, created at 2026-02-02 16:33 +0000
« 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.feat2traj import feat2traj
4import os
7class TestFeat2Traj:
8 def setup_class(self):
9 fx.test_setup(self, 'feat2traj')
11 def teardown_class(self):
12 fx.test_teardown(self)
14 def test_feat2traj(self):
15 feat2traj(properties=self.properties, **self.paths)
16 assert fx.not_empty(self.paths['output_traj_path'])
18 # Verify trajectory file exists and has reasonable size
19 assert os.path.exists(self.paths['output_traj_path']), "Trajectory file should exist"
20 file_size = os.path.getsize(self.paths['output_traj_path'])
21 assert file_size > 0, "Trajectory file should not be empty"
23 if 'output_top_path' in self.paths and self.paths['output_top_path']:
24 assert fx.not_empty(self.paths['output_top_path'])
25 assert os.path.exists(self.paths['output_top_path']), "Topology file should exist"
27 if 'ref_output_traj_path' in self.paths:
28 ref_size = os.path.getsize(self.paths['ref_output_traj_path'])
29 # Compare file sizes (should be similar for same input)
30 assert abs(file_size - ref_size) / max(file_size, ref_size) < 0.1, "Trajectory sizes should be similar"