From c55a64d97883217db3e46738435690cf19bf7ecd Mon Sep 17 00:00:00 2001 From: Harry Jeffery <henry.jeffery@stfc.ac.uk> Date: Mon, 30 Mar 2015 14:23:38 +0100 Subject: [PATCH] Refs #11355 Transfer projection rows test --- .../Framework/MDAlgorithms/test/CutMDTest.h | 24 +++++++++++++++++++ .../test/python/mantid/api/CutMDTest.py | 10 -------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/Code/Mantid/Framework/MDAlgorithms/test/CutMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/CutMDTest.h index 0e793fc2f47..1f50a890479 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/CutMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/CutMDTest.h @@ -208,6 +208,30 @@ public: algCutMD->setProperty("CheckAxes", false); TS_ASSERT_THROWS(algCutMD->execute(), std::runtime_error); } + + void test_wrong_proj_format_rows() { + const std::string wsName = "__CutMDTest_wrong_proj_rows"; + + // Correct columns + ITableWorkspace_sptr proj = WorkspaceFactory::Instance().createTable(); + proj->addColumn("str", "name"); + proj->addColumn("str", "value"); + proj->addColumn("double", "offset"); + proj->addColumn("str", "type"); + // ...but no rows + + auto algCutMD = FrameworkManager::Instance().createAlgorithm("CutMD"); + algCutMD->initialize(); + algCutMD->setRethrows(true); + algCutMD->setProperty("InputWorkspace", sharedWSName); + algCutMD->setProperty("OutputWorkspace", wsName); + algCutMD->setProperty("Projection", proj); + algCutMD->setProperty("P1Bin", "0.1"); + algCutMD->setProperty("P2Bin", "0.2"); + algCutMD->setProperty("P3Bin", "0.1"); + algCutMD->setProperty("CheckAxes", false); + TS_ASSERT_THROWS(algCutMD->execute(), std::runtime_error); + } }; #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 f0d887d8aab..004021beea6 100644 --- a/Code/Mantid/Framework/PythonInterface/test/python/mantid/api/CutMDTest.py +++ b/Code/Mantid/Framework/PythonInterface/test/python/mantid/api/CutMDTest.py @@ -22,16 +22,6 @@ class CutMDTest(unittest.TestCase): def tearDown(self): DeleteWorkspace(self.__in_md ) - def test_wrong_table_workspace_format_wrong_row_numbers(self): - projection = CreateEmptyTableWorkspace() - # Correct number of columns, and names - projection.addColumn("str", "name") - projection.addColumn("str", "value") - projection.addColumn("double", "offset") - projection.addColumn("str", "type") - # Incorrect number of rows i.e. zero in this case as none added. - self.assertRaises(RuntimeError, CutMD, InputWorkspace=self.__in_md, Projection=projection, OutputWorkspace="out_ws", P1Bin=[0.1], P2Bin=[0.1], P3Bin=[0.1], CheckAxes=False) - def test_orthogonal_slice_with_scaling(self): # We create a fake workspace and check to see that the extents get scaled with the new coordinate system when sliced to_cut = CreateMDWorkspace(Dimensions=3, Extents=[-1,1,-1,1,-1,1], Names='H,K,L', Units='U,U,U') -- GitLab