def test_can_remove_next_residue(self): res = Residue(self.atom1, self.atom2, self.atom3) next_res = Mock(Residue) res._next = next_res next_res._previous = res res.next = None self.assertIsNone(res._next) self.assertIsNone(next_res._previous)
def test_next_res_cannot_be_self(self): res = Residue(self.atom1, self.atom2, self.atom3) with self.assertRaises(ValueError): res.next = res
def test_next_residue_must_be_residue(self): res = Residue(self.atom1, self.atom2, self.atom3) mol = Mock(Molecule) with self.assertRaises(TypeError): res.next = mol
def test_can_assign_next(self): res = Residue(self.atom1, self.atom2, self.atom3) next_res = Mock(Residue) res.next = next_res self.assertIs(res._next, next_res) self.assertIs(next_res._previous, res)