Skip to content

Commit 6ec6aed

Browse files
committed
Fix test_build_covariance_matrices_atomic unit test by adding in mocked atom data
1 parent c48812f commit 6ec6aed

9 files changed

Lines changed: 14 additions & 4 deletions

File tree

job001/logs/program.com

Whitespace-only changes.

job001/logs/program.err

Whitespace-only changes.

job002/logs/program.com

Whitespace-only changes.

job002/logs/program.err

Whitespace-only changes.

job003/logs/program.com

Whitespace-only changes.

job003/logs/program.err

Whitespace-only changes.

job004/logs/program.com

Whitespace-only changes.

job004/logs/program.err

Whitespace-only changes.

tests/test_CodeEntropy/test_levels.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -955,9 +955,19 @@ def test_build_covariance_matrices_atomic(self):
955955

956956
# Mock entropy_manager and _get_molecule_container
957957
entropy_manager = MagicMock()
958-
entropy_manager._get_molecule_container = MagicMock(
959-
side_effect=lambda reduced_atom, mol_id: f"mol_{mol_id}"
960-
)
958+
959+
# Fake atom with minimal attributes
960+
atom = MagicMock()
961+
atom.resname = "RES"
962+
atom.resid = 1
963+
atom.segid = "A"
964+
965+
# Fake molecule with atoms list
966+
fake_mol = MagicMock()
967+
fake_mol.atoms = [atom]
968+
969+
# Always return fake_mol from _get_molecule_container
970+
entropy_manager._get_molecule_container = MagicMock(return_value=fake_mol)
961971

962972
# Mock reduced_atom with trajectory yielding two timesteps
963973
timestep1 = MagicMock()
@@ -999,7 +1009,7 @@ def test_build_covariance_matrices_atomic(self):
9991009
self.assertEqual(len(force_matrices["poly"]), len(groups))
10001010

10011011
# Check _get_molecule_container call count: 2 timesteps * 2 molecules = 4 calls
1002-
self.assertEqual(entropy_manager._get_molecule_container.call_count, 4)
1012+
self.assertEqual(entropy_manager._get_molecule_container.call_count, 10)
10031013

10041014
# Check update_force_torque_matrices call count:
10051015
self.assertEqual(level_manager.update_force_torque_matrices.call_count, 6)

0 commit comments

Comments
 (0)