Skip to content

Commit

Permalink
Updated tests for latest improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
csbrasnett committed Jul 17, 2024
1 parent a887575 commit c4c3736
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 24 deletions.
30 changes: 7 additions & 23 deletions polyply/tests/test_apply_modifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import vermouth.forcefield
import vermouth.ffinput
from polyply.src.meta_molecule import MetaMolecule
from polyply.src.apply_modifications import _get_protein_termini, apply_mod, ApplyModifications
from polyply.src.apply_modifications import _patch_protein_termini, apply_mod, ApplyModifications
from polyply import TEST_DATA
import polyply.src.ff_parser_sub
import networkx as nx
Expand All @@ -34,7 +34,7 @@ def test_annotate_protein(example_meta_molecule):
result = [({'resid': 1, 'resname': 'A'}, 'N-ter'),
({'resid': 3, 'resname': 'A'}, 'C-ter')]

termini = _get_protein_termini(example_meta_molecule)
termini = _patch_protein_termini(example_meta_molecule)
assert termini == result

@pytest.mark.parametrize(
Expand Down Expand Up @@ -84,7 +84,7 @@ def test_apply_mod(caplog):
meta_mol = MetaMolecule.from_itp(ff, file_name, name)

#apply the mods
termini = _get_protein_termini(meta_mol)
termini = _patch_protein_termini(meta_mol)
apply_mod(meta_mol, termini)

#for each mod applied, check that the mod atom and interactions have been changed correctly
Expand All @@ -110,25 +110,9 @@ def test_apply_mod(caplog):
parameters=interaction.parameters,
meta=interaction.meta)
assert _interaction in meta_mol.molecule.interactions[interaction_type]
def test_ApplyModifications(example_meta_molecule, caplog):#
ApplyModifications(modifications=[],
meta_molecule=example_meta_molecule).run_molecule(example_meta_molecule)

@pytest.mark.parametrize('modifications, protein_termini, expected',
(
(
None,
False,
True
),
(None,
True,
False)
))
def test_ApplyModifications(example_meta_molecule, caplog, modifications, protein_termini, expected):

ApplyModifications(modifications=modifications,
protter=protein_termini).run_molecule(example_meta_molecule)

if expected:
print(caplog.records)
assert any(rec.levelname == 'WARNING' for rec in caplog.records)
assert any(rec.levelname == 'WARNING' for rec in caplog.records)

Original file line number Diff line number Diff line change
@@ -1 +1 @@
polyply gen_itp -lib martini3 -seqf ../PNt.fasta -o PROT.itp -name PROT -protter
polyply gen_itp -lib martini3 -seqf ../PNt.fasta -o PROT.itp -name PROT

0 comments on commit c4c3736

Please sign in to comment.