Skip to content

Commit 49565ef

Browse files
committed
added test for ValueError in get_residue_custom_axes
1 parent 266d859 commit 49565ef

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

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

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,7 @@ def test_get_bonded_axes_from_topology_returns_none_when_custom_axes_none(
12111211
get_flipped.assert_not_called()
12121212

12131213

1214-
def test_get_residue_axes_custom_path(monkeypatch):
1214+
def test_get_residue_custom_axes(monkeypatch):
12151215
ax = AxesCalculator()
12161216

12171217
edge_atoms = _FakeAtomGroup(
@@ -1228,6 +1228,19 @@ def test_get_residue_axes_custom_path(monkeypatch):
12281228
assert rot_axes.shape == (3, 3)
12291229

12301230

1231+
def test_get_residue_custom_axes_raises(monkeypatch):
1232+
ax = AxesCalculator()
1233+
edge_atoms = _FakeAtomGroup(
1234+
[_FakeAtom(8, 12.0, [1, 0, 0]), _FakeAtom(10, 14.0, [0, 0, 0])],
1235+
positions=np.array([[1.0, 0.0, 0.0], [0.0, 0.0, 0.0]], dtype=float),
1236+
)
1237+
backbone_center = np.array([2.0, 0.0, 0.0])
1238+
with pytest.raises(ValueError):
1239+
ax.get_residue_custom_axes(
1240+
[edge_atoms[0].position, edge_atoms[1].position], backbone_center
1241+
)
1242+
1243+
12311244
def test_get_custom_residue_moment_of_inertia(monkeypatch):
12321245
ax = AxesCalculator()
12331246
heavy_atoms = _FakeAtomGroup(
@@ -1331,6 +1344,8 @@ def _select_atoms(q):
13311344
u, index=1, relative_index=0
13321345
)
13331346

1347+
#
1348+
13341349
assert len(edge_atom_set) == 2
13351350
assert np.allclose(trans_axes, np.eye(3))
13361351
assert rot_axes.shape == (3, 3)
@@ -1347,7 +1362,7 @@ def test_get_residue_bonded_axes_terminal_resid(monkeypatch):
13471362
residue.__len__.return_value = 3
13481363
uas = _FakeAtomGroup(
13491364
[
1350-
_atom(index=0, mass=12.0, pos=[1, 0, 0]),
1365+
_atom(index=0, mass=12.0, pos=[1, -1, 0]),
13511366
_atom(index=1, mass=12.0, pos=[0, 1, 0]),
13521367
_atom(index=2, mass=12.0, pos=[0, 0, 0]),
13531368
]

0 commit comments

Comments
 (0)