Skip to content

Commit 7f85a4f

Browse files
committed
added new unit tests
1 parent d2aaf9b commit 7f85a4f

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

‎tests/unit/CodeEntropy/levels/test_axes.py‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,3 +716,39 @@ def test_get_bonded_axes_returns_none_none_if_custom_axes_none(monkeypatch):
716716

717717
assert custom_axes is None
718718
assert moi is None
719+
720+
721+
def test_get_residue_axes_custom_path(monkeypatch):
722+
ax = AxesCalculator()
723+
724+
edge_atoms = _FakeAtomGroup(
725+
[_FakeAtom(8, 12.0, [1, 0, 0]), _FakeAtom(10, 14.0, [0, 0, 0])],
726+
positions=np.array([[1.0, 0.0, 0.0], [0.0, 0.0, 0.0]], dtype=float),
727+
)
728+
729+
backbone_center = np.array([0.0, 1.0, 0.0])
730+
rot_center, rot_axes = ax.get_residue_custom_axes(
731+
[edge_atoms[0], edge_atoms[1]], backbone_center
732+
)
733+
734+
assert rot_center.shape == (3,)
735+
assert rot_axes.shape == (3, 3)
736+
737+
738+
def test_get_custom_residue_moment_of_inertia(monkeypatch):
739+
ax = AxesCalculator()
740+
heavy_atoms = _FakeAtomGroup(
741+
[_FakeAtom(0, 12.0, [1, 2, 1]), _FakeAtom(1, 12.0, [2, 1, 1])],
742+
positions=np.array([[1, 2, 1], [2, 1, 1]], dtype=float),
743+
)
744+
dimensions = np.array([10.0, 10.0, 10.0], dtype=float)
745+
746+
moi = ax.get_custom_residue_moment_of_inertia(
747+
center_of_mass=np.array([1, 1, 1]),
748+
positions=heavy_atoms.positions,
749+
masses=heavy_atoms.masses,
750+
custom_rot_axes=np.eye(3),
751+
dimensions=dimensions,
752+
)
753+
754+
assert moi.shape == (3,)

0 commit comments

Comments
 (0)