def test_can_remove_previous_residue(self): res = Residue(self.atom1, self.atom2, self.atom3) previous_res = Mock(Residue) res._previous = previous_res previous_res._next = res res.previous = None self.assertIsNone(res._previous) self.assertIsNone(previous_res._next)
def test_previous_residue_must_be_residue(self): res = Residue(self.atom1, self.atom2, self.atom3) mol = Mock(Molecule) with self.assertRaises(TypeError): res.previous = mol
def test_previous_res_cannot_be_self(self): res = Residue(self.atom1, self.atom2, self.atom3) with self.assertRaises(ValueError): res.previous = res
def test_can_assign_previous(self): res = Residue(self.atom1, self.atom2, self.atom3) previous_res = Mock(Residue) res.previous = previous_res self.assertIs(res._previous, previous_res) self.assertIs(previous_res._next, res)