Skip to content
Snippets Groups Projects
Commit 4eafac6b authored by Harry Jeffery's avatar Harry Jeffery
Browse files

Refs #11355 Transfer 4th bin param test

parent 56c1cc33
No related branches found
No related tags found
No related merge requests found
......@@ -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_ */
......@@ -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.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment