Coverage for biobb_pytorch / test / unitests / test_mdae / test_decode_model.py: 82%
17 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.decode_model import evaluateDecoder
4import numpy as np
7class TestDecodeModel:
8 def setup_class(self):
9 fx.test_setup(self, 'evaluateDecoder')
11 def teardown_class(self):
12 fx.test_teardown(self)
14 def test_decode_model(self):
15 evaluateDecoder(properties=self.properties, **self.paths)
16 assert fx.not_empty(self.paths['output_results_npz_path'])
18 results = np.load(self.paths['output_results_npz_path'], allow_pickle=True)
19 assert 'xhat' in results, "Results should contain decoded/reconstructed data (xhat)"
21 if 'ref_output_results_npz_path' in self.paths:
22 ref_results = np.load(self.paths['ref_output_results_npz_path'], allow_pickle=True)
23 # Compare decoded data dimensions
24 if 'xhat' in results and 'xhat' in ref_results:
25 assert results['xhat'].shape[0] == ref_results['xhat'].shape[0], "Number of samples should match"