def test_can_remove_structure(self):
     structure = AtomStructure(self.atom1, self.atom2, self.atom3)
     other = Mock(AtomStructure)
     other._atoms = {self.atom3}
     structure.remove(other)
     self.assertEqual(structure._id_atoms, {500: {self.atom1, self.atom2}})
     self.assertEqual(structure._atoms, {self.atom1, self.atom2})
 def test_can_update_atom_awareness(self):
     self.atom1._model, self.atom2._model, self.atom3._model = 5, 5, 5
     try:
         structure = AtomStructure(self.atom1, self.atom2, self.atom3)
         structure.remove(self.atom2)
         AtomStructure.__name__ = "Model"
         structure.remove(self.atom1)
         self.assertIs(self.atom1._model, None)
     finally:
         AtomStructure.__name__ = "AtomStructure"
 def test_can_remove_atom_from_structure(self):
     structure = AtomStructure(self.atom1, self.atom2, self.atom3)
     self.assertEqual(structure._id_atoms, {
         500: {self.atom1, self.atom2},
         700: {self.atom3}
     })
     self.assertEqual(structure._atoms, set(self.atoms))
     structure.remove(self.atom1)
     self.assertEqual(structure._id_atoms, {
         500: {self.atom2},
         700: {self.atom3}
     })
     self.assertEqual(structure._atoms, set(self.atoms[1:]))
     mock_atom = Mock(Atom)
     mock_atom.id = 300
     structure.remove(mock_atom)
     structure.remove(self.atom2)
     self.assertEqual(structure._id_atoms, {700: {self.atom3}})
     self.assertEqual(structure._atoms, {self.atom3})
     structure.remove(self.atom3)
     self.assertEqual(structure._id_atoms, {})
     self.assertEqual(structure._atoms, set())