Exemplo n.º 1
0
 def test_can_get_atoms_in_sphere(self):
     structure = AtomicStructure(self.atom1, self.atom2, self.atom3)
     atoms = structure.atoms_in_sphere(1, 2, 3, 10)
     self.assertEqual(atoms, {self.atom1, self.atom2})
     self.atom1.distance_to.assert_called_with((1, 2, 3))
     self.atom2.distance_to.assert_called_with((1, 2, 3))
     self.atom3.distance_to.assert_called_with((1, 2, 3))
Exemplo n.º 2
0
 def test_coordinates_must_be_numbers(self):
     structure = AtomicStructure(self.atom1, self.atom2, self.atom3)
     with self.assertRaises(TypeError):
         structure.atoms_in_sphere("0", 0, 0, 10)
     with self.assertRaises(TypeError):
         structure.atoms_in_sphere(0, "0", 0, 10)
     with self.assertRaises(TypeError):
         structure.atoms_in_sphere(0, 0, "0", 10)
Exemplo n.º 3
0
 def test_radius_must_be_positive_number(self):
     structure = AtomicStructure(self.atom1, self.atom2, self.atom3)
     with self.assertRaises(TypeError):
         structure.atoms_in_sphere(0, 0, 0, "10")
     with self.assertRaises(ValueError):
         structure.atoms_in_sphere(0, 0, 0, -10)