def test_can_get_rmsd(self, mock_pair): structure = AtomStructure(self.atom1, self.atom2, self.atom3) other = Mock(AtomStructure) other_atoms = [Mock(), Mock(), Mock()] self.atom1.distance_to.return_value = 5 self.atom2.distance_to.return_value = 1 self.atom3.distance_to.return_value = -1 mock_pair.return_value = { self.atom1: other_atoms[0], self.atom2: other_atoms[1], self.atom3: other_atoms[2] } rmsd = structure.rmsd_with(other) mock_pair.assert_called_with(other) self.atom1.distance_to.assert_called_with(other_atoms[0]) self.atom2.distance_to.assert_called_with(other_atoms[1]) self.atom3.distance_to.assert_called_with(other_atoms[2]) self.assertEqual(rmsd, 3)
def test_can_get_rmsd_after_superposition(self, mock_onto, mock_pair): structure = AtomStructure(self.atom1, self.atom2, self.atom3) other = Mock(AtomStructure) other_atoms = [Mock(), Mock(), Mock()] self.atom1.distance_to.return_value = 5 self.atom2.distance_to.return_value = 1 self.atom3.distance_to.return_value = -1 self.atom1.location = (1, 2, 3) self.atom2.location = (4, 5, 6) self.atom3.location = (7, 8, 9) mock_pair.return_value = { self.atom1: other_atoms[0], self.atom2: other_atoms[1], self.atom3: other_atoms[2] } rmsd = structure.rmsd_with(other, superimpose=True) mock_onto.assert_called_with(other) self.atom1.move_to.assert_called_with(1, 2, 3) self.atom2.move_to.assert_called_with(4, 5, 6) self.atom3.move_to.assert_called_with(7, 8, 9)