Skip to content

Commit 1ecd72f

Browse files
committed
fixed broken test_process_united_atom_entropy unit test
1 parent 6506a9f commit 1ecd72f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tests/test_CodeEntropy/test_entropy.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,8 @@ def test_process_united_atom_entropy(self):
565565
# Mock molecule container with residues and atoms
566566
n_residues = 3
567567
mock_residues = [MagicMock(resname=f"RES{i}") for i in range(n_residues)]
568-
mock_atoms = [MagicMock() for _ in range(9)] # total 9 atoms
568+
mock_atoms_per_mol = 3
569+
mock_atoms = [MagicMock() for _ in range(mock_atoms_per_mol)] # per molecule
569570
mol_container = MagicMock(residues=mock_residues, atoms=mock_atoms)
570571

571572
# Create dummy matrices and states
@@ -581,6 +582,14 @@ def test_process_united_atom_entropy(self):
581582
)
582583
ce.conformational_entropy_calculation.return_value = 3.0
583584

585+
# Manually add the group label so group_id=0 exists
586+
data_logger.add_group_label(
587+
0,
588+
"_".join(f"RES{i}" for i in range(n_residues)), # label
589+
n_residues, # residue_count
590+
len(mock_atoms) * n_residues, # total atoms for the group
591+
)
592+
584593
# Run the method
585594
manager._process_united_atom_entropy(
586595
group_id=0,
@@ -616,7 +625,7 @@ def test_process_united_atom_entropy(self):
616625
group_label = data_logger.group_labels[0] # Access by group_id key
617626
assert group_label["label"] == "_".join(f"RES{i}" for i in range(n_residues))
618627
assert group_label["residue_count"] == n_residues
619-
assert group_label["atom_count"] == len(mol_container.atoms)
628+
assert group_label["atom_count"] == len(mock_atoms) * n_residues
620629

621630
def test_process_vibrational_only_levels(self):
622631
"""

0 commit comments

Comments
 (0)