diff --git a/Code/Mantid/Framework/MDAlgorithms/test/CutMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/CutMDTest.h index e26585b766fbfa2585db0ca604072e667ffa3599..0cbba16589494d9467e251491f872fd7761bb20f 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/CutMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/CutMDTest.h @@ -63,6 +63,34 @@ public: TS_ASSERT_THROWS_NOTHING(alg.initialize()) TS_ASSERT(alg.isInitialized()) } + + void test_exec_throws_if_giving_4th_binning_param_when_workspace_is_3d() { + const std::string wsName = "__CutMDTest_4thbinon3dthrows"; + + FrameworkManager::Instance().exec("CreateMDWorkspace", 10, + "OutputWorkspace", wsName.c_str(), + "Dimensions", "3", + "Extents", "-10,10,-10,10,-10,10", + "Names", "H,K,L", + "Units", "U,U,U"); + + FrameworkManager::Instance().exec("SetSpecialCoordinates", 4, + "InputWorkspace", wsName.c_str(), + "SpecialCoordinates", "HKL"); + + auto algCutMD = FrameworkManager::Instance().createAlgorithm("CutMD"); + algCutMD->initialize(); + algCutMD->setRethrows(true); + algCutMD->setProperty("InputWorkspace", wsName); + algCutMD->setProperty("OutputWorkspace", wsName); + algCutMD->setProperty("P1Bin", "0.1"); + algCutMD->setProperty("P2Bin", "0.1"); + algCutMD->setProperty("P3Bin", "0.1"); + algCutMD->setProperty("P4Bin", "0.1"); + TS_ASSERT_THROWS(algCutMD->execute(), std::runtime_error) + + AnalysisDataService::Instance().remove(wsName); + } }; #endif /* MANTID_MDALGORITHMS_CUTMDTEST_H_ */ diff --git a/Code/Mantid/Framework/PythonInterface/test/python/mantid/api/CutMDTest.py b/Code/Mantid/Framework/PythonInterface/test/python/mantid/api/CutMDTest.py index 203ed1ecb0b930ebf9cc5f7e9b5ec199fd41d1e0..d4553be2dc64607e069aedb9ae4f599c360e67ce 100644 --- a/Code/Mantid/Framework/PythonInterface/test/python/mantid/api/CutMDTest.py +++ b/Code/Mantid/Framework/PythonInterface/test/python/mantid/api/CutMDTest.py @@ -22,12 +22,6 @@ class CutMDTest(unittest.TestCase): def tearDown(self): DeleteWorkspace(self.__in_md ) - def test_exec_throws_if_giving_4th_binning_parameter_when_workspace_is_3D(self): - test_md = CreateMDWorkspace(Dimensions=3, Extents=[-10,10,-10,10,-10,10], Names="H,K,L", Units="U,U,U") - # Explicitly set the coordinate system to lab Q. - SetSpecialCoordinates(InputWorkspace=test_md, SpecialCoordinates='HKL') - self.assertRaises(RuntimeError, CutMD, InputWorkspace=test_md, OutputWorkspace="out_ws", P1Bin=[0.1], P2Bin=[0.1], P3Bin=[0.1], P4Bin=[0.1]) - def test_slice_to_original(self): out_md = CutMD(self.__in_md, P1Bin=[0.1], P2Bin=[0.1], P3Bin=[0.1], CheckAxes=False) self.assertTrue(isinstance(out_md, IMDEventWorkspace), "Should default to producing an IMDEventWorkspace.")