Skip to content

Commit

Permalink
fix test & iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
fgrunewald committed Aug 16, 2023
1 parent f643e72 commit 918cbdc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
6 changes: 2 additions & 4 deletions polyply/src/gen_dna.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def _dna_edge_iterator(meta_molecule, source):
while True:
neighbors = meta_molecule.neighbors(source)
src_resid = meta_molecule.nodes[source]["resid"]
count += 1
for next_node in neighbors:
next_resid = meta_molecule.nodes[next_node]["resid"]
diff = src_resid - next_resid
Expand All @@ -42,9 +41,8 @@ def _dna_edge_iterator(meta_molecule, source):
if next_resid > src_resid and next_node == first_node:
yield (source, next_node)
return

if count > len(meta_molecule.nodes):
return
else:
return

def complement_dsDNA(meta_molecule):
"""
Expand Down
5 changes: 1 addition & 4 deletions polyply/tests/test_gen_dna.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,10 @@ def test_complement_dsDNA(extra_edges, termini, expect_ter):
assert new_edge_attrs[(idx, jdx)] == edge_attr[(idx, jdx)]
else:
assert new_edge_attrs[(idx, jdx)] == edge_attr[(jdx, idx)]

assert len(list(nx.connected_components(test_DNA_mol))) == 2


def test_complement_dsDNA():
def test_complement_dsDNA_error():
"""
Test that an unkown residue generates an error when
passed to gen_dna processor.
Expand All @@ -87,6 +86,4 @@ def test_complement_dsDNA():
"at the moment only allows base-pair completion for molecules that only "
"consist of dsDNA. Please conact the developers if you whish to create a "
"more complicated molecule.")

assert str(context.value) == msg

0 comments on commit 918cbdc

Please sign in to comment.