示例#1
0
 def test_generic_workspace_property(self):
     """
         Tests whether a generic WorkspaceProperty<Workspace>
         can be used from Python
     """
     algm_par = mtd._createAlgProxy("CreateWorkspace")
     algm_par.setPropertyValues(OutputWorkspace="test", DataX=1, DataY=1, DataE=1)
     algm_par.execute()
     ws = algm_par.getProperty("OutputWorkspace").value
     
     algm = GenericWorkspacePropertyTest()
     algm.initialize()
     algm.setPropertyValue("InputWorkspace", "test")
     algm.setPropertyValue("OutputWorkspace", "testout")
     algm.execute()
     self.assertTrue(algm.isExecuted())
     self.assertTrue(mtd.workspaceExists("testout"))
示例#2
0
 def test_cpp_alg_property_using_python_alg(self):
     """
         Declare, set and get a C++ algorithm from a python algorithm
     """
     algm_par = mtd._createAlgProxy("CreateWorkspace")
     algm_par.setPropertyValues(OutputWorkspace="test", DataX=1, DataY=1, DataE=1)
     algm_par.initialize()
     
     algm = DummyAlg()
     algm.initialize()
     algm.setPropertyValue("OutputWorkspace", "ChildAlgtest")
     algm._setAlgorithmProperty("Algo", algm_par._getHeldObject())
     algm.execute()
     self.assertEqual(str(algm._getAlgorithmProperty("Algo")), 
                      "CreateWorkspace.1(OutputWorkspace=test,DataX=1,DataY=1,DataE=1)")
     self.assertTrue(mtd.workspaceExists("ChildAlgtest"))
     mtd.deleteWorkspace("ChildAlgtest")
示例#3
0
 def test_algp_property_using_public_API(self):
     """
         Declare, set and get an algorithm property from a python algorithm
         using the public API. Only works if the algorithm owning the AlgorithmProperty
         is a PythonAlgorithm.
     """
     algm_par = mtd._createAlgProxy("CreateWorkspace")
     algm_par.setPropertyValues(OutputWorkspace="test", DataX=1, DataY=1, DataE=1)
     algm_par.initialize()
     
     algm = DummyAlg()
     algm.initialize()
     algm.setPropertyValue("OutputWorkspace", "ChildAlgtest")
     algm.setProperty("Algo", algm_par._getHeldObject())
     algm.execute()
     self.assertEqual(str(algm._getAlgorithmProperty("Algo")), 
                      "CreateWorkspace.1(OutputWorkspace=test,DataX=1,DataY=1,DataE=1)")
     self.assertTrue(mtd.workspaceExists("ChildAlgtest"))
     mtd.deleteWorkspace("ChildAlgtest")
示例#4
0
 def test_cpp_alg_property_using_python_alg_and_execute_the_propertied_algorithm(self):
     """
         Declare, seta C++ algorithm from a python algorithm.
         Then, in the "super" python algorithm, run the "sub" algorithm that
         was passed as a parameter
     """
     algm_par = mtd._createAlgProxy("CreateWorkspace")
     algm_par.setPropertyValues(OutputWorkspace="test", DataX=1, DataY=1, DataE=1)
     algm_par.initialize()
     
     algm = DummyAlg3()
     algm.initialize()
     algm.setPropertyValue("OutputWorkspace", "ChildAlgtest")
     algm._setAlgorithmProperty("Algo", algm_par._getHeldObject())
     algm.execute()
     # THe algorithm created the workspace name given in the PROPERTY ...
     self.assertTrue(mtd.workspaceExists("test"))
     mtd.deleteWorkspace("test")
     # ... not the one given as a parameter of DummyAlg3, because that's not the way that algo was written
     self.assertFalse(mtd.workspaceExists("ChildAlgtest"))
示例#5
0
 def test_setWikiSummary_on_proxy(self):
     algm_par = mtd._createAlgProxy("CreateWorkspace")
     summary = "summary message"
     algm_par.setWikiSummary(summary)
     self.assertEquals(summary, algm_par.getWikiSummary())