"vscode:/vscode.git/clone" did not exist on "e1aec29231a4df65a58e9e7b8b2209a6786b2d93"
Commit c147e062 authored by John Chodera (MSKCC)'s avatar John Chodera (MSKCC)
Browse files

Fix broken TestTopology test.

parent 1c603b1a
......@@ -373,18 +373,15 @@ class Residue(object):
def bonds(self):
"""Iterate over all Bonds involving any atom in this residue."""
bonds = [ bond for bond in self.chain.topology.bonds() if ((bond[0] in self._atoms) or (bond[1] in self._atoms)) ]
return iter(bonds)
return ( bond for bond in self.chain.topology.bonds() if ((bond[0] in self._atoms) or (bond[1] in self._atoms)) )
def internal_bonds(self):
"""Iterate over all internal Bonds."""
bonds = [ bond for bond in self.chain.topology.bonds() if ((bond[0] in self._atoms) and (bond[1] in self._atoms)) ]
return iter(bonds)
return ( bond for bond in self.chain.topology.bonds() if ((bond[0] in self._atoms) and (bond[1] in self._atoms)) )
def external_bonds(self):
"""Iterate over all Bonds to external atoms."""
bonds = [ bond for bond in self.chain.topology.bonds() if ((bond[0] in self._atoms) != (bond[1] in self._atoms)) ]
return iter(bonds)
return ( bond for bond in self.chain.topology.bonds() if ((bond[0] in self._atoms) != (bond[1] in self._atoms)) )
def __len__(self):
return len(self._atoms)
......
......@@ -39,6 +39,9 @@ class TestTopology(unittest.TestCase):
atom_B1 = topology.addAtom('B1', element.carbon, residue2)
atom_B2 = topology.addAtom('B2', element.carbon, residue2)
atom_C1 = topology.addAtom('C1', element.carbon, residue3)
topology.addBond(atom_A1, atom_B1)
topology.addBond(atom_B1, atom_B2)
topology.addBond(atom_B2, atom_C1)
# Check bonds
all_bonds = [ bond for bond in residue2.bonds() ]
internal_bonds = [ bond for bond in residue2.internal_bonds() ]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment