From b9b8dd00ce72880e006439c6669b173b44eb7334 Mon Sep 17 00:00:00 2001
From: Bhuvan Bezawada <bhuvan_777@outlook.com>
Date: Tue, 17 Jul 2018 09:41:35 +0100
Subject: [PATCH] Added minor changes to exposed methods

re #22885
---
 .../geometry/src/Exports/DetectorInfo.cpp     | 60 ++++++++-----------
 .../mantid/geometry/DetectorInfoTest.py       | 11 ++++
 2 files changed, 35 insertions(+), 36 deletions(-)

diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/DetectorInfo.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/DetectorInfo.cpp
index 80ee4cb2d49..7520c357aae 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/DetectorInfo.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/DetectorInfo.cpp
@@ -41,49 +41,37 @@ void export_DetectorInfo() {
 
   // Export to Python
   class_<DetectorInfo, boost::noncopyable>("DetectorInfo", no_init)
-      .def("__len__", &DetectorInfo::size, (arg("self")),
-           "Returns the size of the DetectorInfo, i.e., the number of "
-           "detectors in the instrument.")
+    .def("__len__", &DetectorInfo::size, (arg("self")),
+      "Returns the size of the DetectorInfo, i.e., the number of "
+      "detectors in the instrument.")
 
-      .def("size", &DetectorInfo::size, (arg("self")),
-           "Returns the size of the DetectorInfo, i.e., the number of "
-           "detectors in the instrument.")
+    .def("size", &DetectorInfo::size, (arg("self")),
+      "Returns the size of the DetectorInfo, i.e., the number of "
+      "detectors in the instrument.")
 
-      .def("isMonitor", isMonitor, (arg("self"), arg("index")),
-           "Returns True if the detector is a monitor.")
+    .def("isMonitor", isMonitor, (arg("self"), arg("index")),
+      "Returns True if the detector is a monitor.")
 
-      .def("isMasked", isMasked, (arg("self"), arg("index")),
-           "Returns True if the detector is masked.")
+    .def("isMasked", isMasked, (arg("self"), arg("index")),
+      "Returns True if the detector is masked.")
 
-      .def("isEquivalent", &DetectorInfo::isEquivalent,
-           (arg("self"), arg("other")),
-           "Returns true if the content of this is equivalent to the content "
-           "of other.")
+    .def("isEquivalent", &DetectorInfo::isEquivalent,
+    (arg("self"), arg("other")),
+      "Returns true if the content of this is equivalent to the content "
+      "of other.")
 
-      .def("twoTheta", twoTheta, (arg("self"), arg("index")),
-           "Returns 2 theta (scattering angle w.r.t.to beam direction).")
+    .def("twoTheta", twoTheta, (arg("self"), arg("index")),
+      "Returns 2 theta (scattering angle w.r.t beam direction).")
 
-      .def("signedTwoTheta", signedTwoTheta, (arg("self"), arg("index")),
-           "Returns signed 2 theta (signed scattering angle w.r.t. to beam "
-           "direction).")
+    .def("position", position, (arg("self"), arg("index")),
+      "Returns the absolute position of the detector with given index.")
 
-      .def("position", position, (arg("self"), arg("index")),
-           "Returns the absolute position of the detector with given index.")
+    .def("rotation", rotation, (arg("self"), arg("index")),
+      "Returns the absolute rotation of the detector with given index.")
 
-      .def("rotation", rotation, (arg("self"), arg("index")),
-           "Returns the absolute rotation of the detector with given index.")
+    .def("setMasked", setMasked, (arg("self"), arg("index"), arg("masked")),
+      "Set the mask flag of the detector with given index.")
 
-      .def("setMasked", setMasked, (arg("self"), arg("index"), arg("masked")),
-           "Set the mask flag of the detector with given index.")
-
-      .def("clearMaskFlags", &DetectorInfo::clearMaskFlags, (arg("self")),
-           "Sets all mask flags to false (unmasked).")
-
-      .def("setPosition", setPosition,
-           (arg("self"), arg("index"), arg("position")),
-           "Set the absolute position of the detector with given index.")
-
-      .def("setRotation", setRotation,
-           (arg("self"), arg("index"), arg("rotation")),
-           "Set the absolute rotation of the detector with given index.");
+    .def("clearMaskFlags", &DetectorInfo::clearMaskFlags, (arg("self")),
+      "Sets all mask flags to false (unmasked).");
 }
diff --git a/Framework/PythonInterface/test/python/mantid/geometry/DetectorInfoTest.py b/Framework/PythonInterface/test/python/mantid/geometry/DetectorInfoTest.py
index 7376291bd1e..4475e19b0d3 100644
--- a/Framework/PythonInterface/test/python/mantid/geometry/DetectorInfoTest.py
+++ b/Framework/PythonInterface/test/python/mantid/geometry/DetectorInfoTest.py
@@ -4,6 +4,7 @@ import unittest
 from testhelpers import WorkspaceCreationHelper
 from mantid.kernel import V3D
 from mantid.kernel import Quat
+from mantid.simpleapi import *
 
 class DetectorInfoTest(unittest.TestCase):
 
@@ -92,5 +93,15 @@ class DetectorInfoTest(unittest.TestCase):
         retQuat = info.rotation(0)
         self.assertEquals(quat, retQuat)
 
+    def test_createWorkspaceAndDetectorInfo(self):
+    	""" Try to create a workspace and see if DetectorInfo object
+    		is accessable """
+    	dataX = [1,2,3,4,5]
+    	dataY = [1,2,3,4,5]
+    	workspace = CreateWorkspace(DataX=dataX, DataY=dataY)
+    	info = workspace.detectorInfo()
+    	self.assertEquals(info.size(), 0)
+
+
 if __name__ == '__main__':
     unittest.main()
-- 
GitLab