Skip to content

Commit

Permalink
improved itp test
Browse files Browse the repository at this point in the history
  • Loading branch information
csbrasnett committed Oct 10, 2024
1 parent 59c9827 commit 676cd78
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions polyply/tests/test_apply_modifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,15 @@ def test_apply_mod(input_itp, molname, expected, caplog, text):
meta=interaction.meta)
assert _interaction in meta_mol.molecule.interactions[interaction_type]

def test_from_itp(caplog):

@pytest.mark.parametrize('adding, expected',
(
(True,
True),
(False,
False)
))
def test_from_itp(caplog, adding, expected):

caplog.set_level(logging.INFO)
#make the meta molecule from the itp and ff files
Expand All @@ -159,20 +167,24 @@ def test_from_itp(caplog):

meta_mol = MetaMolecule.from_itp(ff, file_name, "pALA")

for node in meta_mol.nodes:
meta_mol.nodes[node]['from_itp'] = 'True'
if adding:
for node in meta_mol.nodes:
meta_mol.nodes[node]['from_itp'] = 'True'

termini = _patch_protein_termini(meta_mol)
apply_mod(meta_mol, termini)

found = False
expected_msg = "meta_molecule has come from itp. Will not attempt to modify."
for record in caplog.records:
if record.message == expected_msg:
assert True
found = True
break
else:
continue

assert found == expected

@pytest.mark.parametrize('modifications, expected, text',
(
(
Expand Down

0 comments on commit 676cd78

Please sign in to comment.