From a36d42a6e304c52e2ec4bfe75d0355567ed802c4 Mon Sep 17 00:00:00 2001
From: Federico Montesino Pouzols <federico.montesino-pouzols@stfc.ac.uk>
Date: Sat, 6 Feb 2016 19:11:58 +0000
Subject: [PATCH] new outputs in unit tests, re #15180

---
 .../plugins/algorithms/EnggCalibrateTest.py   | 20 +++++++++---------
 .../plugins/algorithms/EnggFitPeaksTest.py    | 21 ++++++++++++++-----
 2 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/Framework/PythonInterface/test/python/plugins/algorithms/EnggCalibrateTest.py b/Framework/PythonInterface/test/python/plugins/algorithms/EnggCalibrateTest.py
index 5be72300d66..4a62286d0f1 100644
--- a/Framework/PythonInterface/test/python/plugins/algorithms/EnggCalibrateTest.py
+++ b/Framework/PythonInterface/test/python/plugins/algorithms/EnggCalibrateTest.py
@@ -79,10 +79,10 @@ class EnggCalibrateTest(unittest.TestCase):
         Checks normal operation.
         """
 
-        difc, zero = sapi.EnggCalibrate(InputWorkspace=self.__class__._data_ws,
-                                        VanIntegrationWorkspace=self.__class__._van_integ_tbl,
-                                        VanCurvesWorkspace=self.__class__._van_curves_ws,
-                                        ExpectedPeaks=[1.6, 1.1, 1.8], Bank='2')
+        difc, zero, peaks = sapi.EnggCalibrate(InputWorkspace=self.__class__._data_ws,
+                                               VanIntegrationWorkspace=self.__class__._van_integ_tbl,
+                                               VanCurvesWorkspace=self.__class__._van_curves_ws,
+                                               ExpectedPeaks=[1.6, 1.1, 1.8], Bank='2')
 
         self.check_3peaks_values(difc, zero)
 
@@ -93,12 +93,12 @@ class EnggCalibrateTest(unittest.TestCase):
         """
         # This file has: 1.6, 1.1, 1.8 (as the test above)
         filename = 'EnginX_3_expected_peaks_unittest.csv'
-        difc, zero = sapi.EnggCalibrate(InputWorkspace=self.__class__._data_ws,
-                                        VanIntegrationWorkspace=self.__class__._van_integ_tbl,
-                                        VanCurvesWorkspace=self.__class__._van_curves_ws,
-                                        ExpectedPeaks=[-4, 40, 323], # nonsense, but FromFile should prevail
-                                        ExpectedPeaksFromFile=filename,
-                                        Bank='2')
+        difc, zero, peaks = sapi.EnggCalibrate(InputWorkspace=self.__class__._data_ws,
+                                               VanIntegrationWorkspace=self.__class__._van_integ_tbl,
+                                               VanCurvesWorkspace=self.__class__._van_curves_ws,
+                                               ExpectedPeaks=[-4, 40, 323], # nonsense, but FromFile should prevail
+                                               ExpectedPeaksFromFile=filename,
+                                               Bank='2')
 
         self.check_3peaks_values(difc, zero)
 
diff --git a/Framework/PythonInterface/test/python/plugins/algorithms/EnggFitPeaksTest.py b/Framework/PythonInterface/test/python/plugins/algorithms/EnggFitPeaksTest.py
index 32f563acfca..fdb5c06b409 100644
--- a/Framework/PythonInterface/test/python/plugins/algorithms/EnggFitPeaksTest.py
+++ b/Framework/PythonInterface/test/python/plugins/algorithms/EnggFitPeaksTest.py
@@ -32,6 +32,12 @@ class EnggFitPeaksTest(unittest.TestCase):
                           InputWorkspace=ws_name, BankPixelFoo=33,
                           WorkspaceIndex=0, ExpectedPeaks='0.51, 0.72')
 
+        # missing FittedPeaks output property
+        self.assertRaises(RuntimeError,
+                          EnggFitPeaks,
+                          InputWorkspace=ws_name,
+                          WorkspaceIndex=0, ExpectedPeaks='0.51, 0.72')
+
         # Wrong ExpectedPeaks value
         self.assertRaises(ValueError,
                           EnggFitPeaks,
@@ -164,9 +170,12 @@ class EnggFitPeaksTest(unittest.TestCase):
         ep1 = 0.4
         ep2 = 1.09
         paramsTblName = 'test_difc_zero_table'
-        difc, zero = EnggFitPeaks(sws, WorkspaceIndex=0, ExpectedPeaks=[ep1, ep2],
-                                    OutFittedPeaksTable=peaksTblName,
-                                    OutParametersTable=paramsTblName)
+        difc, zero, test_fit_peaks_table = EnggFitPeaks(sws, WorkspaceIndex=0, ExpectedPeaks=[ep1, ep2],
+                                                        OutFittedPeaksTable=peaksTblName,
+                                                        OutParametersTable=paramsTblName)
+
+        self.assertEquals(test_fit_peaks_table.rowCount(), 2)
+
         pTable = mtd[paramsTblName]
         self.assertEquals(pTable.rowCount(), 1)
         self.assertEquals(pTable.columnCount(), 2)
@@ -205,8 +214,10 @@ class EnggFitPeaksTest(unittest.TestCase):
         ep1 = 0.4
         ep2 = 0.83
         ep3 = 1.09
-        difc, zero = EnggFitPeaks(sws, WorkspaceIndex=0, ExpectedPeaks=[ep1, ep2, ep3],
-                                    OutFittedPeaksTable=peaksTblName)
+        difc, zero, test_fit_peaks_table = EnggFitPeaks(sws, WorkspaceIndex=0, ExpectedPeaks=[ep1, ep2, ep3],
+                                                        OutFittedPeaksTable=peaksTblName)
+
+        self.assertEquals(test_fit_peaks_table.rowCount(), 3)
 
         expected_difc = 17335.67250113934
         # assertLess would be nices, but only available in unittest >= 2.7
-- 
GitLab