Skip to content

Commit

Permalink
Add unit test for UpdatePeakParameterTableValue. Refs #6679.
Browse files Browse the repository at this point in the history
  • Loading branch information
wdzhou committed Mar 7, 2013
1 parent bc1c118 commit 6517339
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set ( TEST_PY_FILES
MaskWorkspaceToCalFileTest.py
RetrieveRunInfoTest.py
Stitch1DTest.py
UpdatePeakParameterTableValueTest.py
)

# Prefix for test name=PythonAlgorithms
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import unittest
import numpy
from mantid.kernel import *
from mantid.api import *
from testhelpers import run_algorithm
from mantid.api import AnalysisDataService

class UpdatePeakParameterTableValueTest(unittest.TestCase):

def test_updateDouble(self):
""" Test for update a double value
"""
# tablews = self.create_TableWorkspace()

alg_init = run_algorithm("CreateEmptyTableWorkspace", OutputWorkspace="TestTableWorkspace")
self.assertTrue(alg_init.isExecuted())

tablews = AnalysisDataService.retrieve("TestTableWorkspace")

tablews.addColumn("str", "Name")
tablews.addColumn("double", "Value")
tablews.addColumn("str", "FitOrTie")

tablews.addRow(["A", 1.34, "Fit"])
tablews.addRow(["B", 2.34, "Tie"])
tablews.addRow(["S", 3.34, "Tie"])

alg_test = run_algorithm("UpdatePeakParameterTableValue", InputWorkspace=alg_init.getPropertyValue("OutputWorkspace"),
Column="Value", ParameterNames=["A"], NewFloatValue=1.00)

self.assertTrue(alg_test.isExecuted())

newvalue_A = tablews.cell(0, 1)

self.assertEqual(newvalue_A, 1.00)

return

if __name__ == '__main__':
unittest.main()

0 comments on commit 6517339

Please sign in to comment.