diff --git a/tests/test_parsing.py b/tests/test_parsing.py index 4a892114..c3ef6223 100644 --- a/tests/test_parsing.py +++ b/tests/test_parsing.py @@ -1,12 +1,14 @@ import re import string -import pytest -from hypothesis import settings, HealthCheck, given, strategies as st from pathlib import Path +import pytest +from hypothesis import HealthCheck, given, settings +from hypothesis import strategies as st + from kimmdy import parsing -from kimmdy.utils import get_gmx_dir from kimmdy.constants import AA3 +from kimmdy.utils import get_gmx_dir ## test topology parser @@ -40,6 +42,7 @@ def test_doubleparse_urea(arranged_tmp_path): def test_ff_includes_with_gmxdir(arranged_tmp_path): top_dict = parsing.read_top(Path("urea.top")) gmx_dir = get_gmx_dir("gmx") + assert gmx_dir is not None, "gmx dir not found" tip3_dict = parsing.read_top(gmx_dir / "top" / "amber99.ff" / "tip3p.itp") assert top_dict["atomtypes"] diff --git a/tests/test_recipe.py b/tests/test_recipe.py index 23a270f8..02520c66 100644 --- a/tests/test_recipe.py +++ b/tests/test_recipe.py @@ -128,9 +128,9 @@ def test_place_initialization(): assert m2 != m3 with pytest.raises(TypeError): - recipe.Place(ix_to_place=1) + recipe.Place(ix_to_place=1) # type: ignore with pytest.raises(ValueError): - recipe.Place(id_to_place=1, new_coords=(0, 0, 0)) + recipe.Place(id_to_place=1, new_coords=(0, 0, 0)) # type: ignore def test_relax_initialization(): diff --git a/tests/test_topology.py b/tests/test_topology.py index 2cdfbafd..2616fdf2 100644 --- a/tests/test_topology.py +++ b/tests/test_topology.py @@ -331,7 +331,8 @@ def test_del_atom_hexala(self, hexala_top_fix, atomindex): for a_del in angles_to_delete: assert None in [update.get(a) for a in a_del] for a_up in angles_to_update: - new = top.angles[tuple([update.get(a) for a in a_up])] + k1, k2, k3 = [update[a] for a in a_up] + new = top.angles[k1, k2, k3] old = hexala_top_fix.angles[a_up] assert old.ai == rev_update.get(new.ai) assert old.aj == rev_update.get(new.aj) @@ -341,7 +342,8 @@ def test_del_atom_hexala(self, hexala_top_fix, atomindex): for pd_del in pd_to_delete: assert None in tuple([update.get(a) for a in pd_del]) for pd_up in pd_to_update: - new = top.proper_dihedrals[tuple([update.get(a) for a in pd_up])] + k1, k2, k3, k4 = [update[a] for a in pd_up] + new = top.proper_dihedrals[k1, k2, k3, k4] old = hexala_top_fix.proper_dihedrals[pd_up] assert old.ai == rev_update.get(new.ai) assert old.aj == rev_update.get(new.aj) @@ -360,7 +362,8 @@ def test_del_atom_hexala(self, hexala_top_fix, atomindex): for id_del in id_to_delete: assert None in tuple([update.get(a) for a in id_del]) for id_up in id_to_update: - new = top.improper_dihedrals[tuple([update.get(a) for a in id_up])] + k1, k2, k3, k4 = [update[a] for a in id_up] + new = top.improper_dihedrals[k1, k2, k3, k4] old = hexala_top_fix.improper_dihedrals[id_up] assert old.ai == rev_update.get(new.ai) assert old.aj == rev_update.get(new.aj) @@ -637,9 +640,10 @@ def test_top_update_dict(self, raw_hexala_top_fix): assert raw["moleculetype_Protein"]["content"][0] == ["Protein", "3"] assert top.top["moleculetype_Reactive"]["content"][0] == ["Reactive", "3"] for section in ["atoms", "bonds", "angles", "dihedrals", "pairs"]: - top.top["moleculetype_Reactive"]["subsections"][section]["content"] == raw[ - "moleculetype_Protein" - ]["subsections"][section]["content"] + assert ( + top.top["moleculetype_Reactive"]["subsections"][section]["content"] + == raw["moleculetype_Protein"]["subsections"][section]["content"] + ) def test_top_properties(self, hexala_top_fix): top = deepcopy(hexala_top_fix)