Skip to content
Snippets Groups Projects
Commit 8750589c authored by Elliot Oram's avatar Elliot Oram
Browse files

Update unit tests with python list inputs

Refs #15816
parent a50f78c6
No related merge requests found
...@@ -11,8 +11,8 @@ class VesuvioThicknessTest(unittest.TestCase): ...@@ -11,8 +11,8 @@ class VesuvioThicknessTest(unittest.TestCase):
def test_basic_input(self): def test_basic_input(self):
# Original test values from fortran routines # Original test values from fortran routines
masses = "1.0079,27.0,91.0" masses = [1.0079, 27.0, 91.0]
amplitudes = "0.9301589,2.9496644e-02,4.0345035e-02" amplitudes = [0.9301589, 2.9496644e-02, 4.0345035e-02]
trans_guess = 0.831 trans_guess = 0.831
thickness = 5.0 thickness = 5.0
number_density = 1.0 number_density = 1.0
...@@ -32,16 +32,32 @@ class VesuvioThicknessTest(unittest.TestCase): ...@@ -32,16 +32,32 @@ class VesuvioThicknessTest(unittest.TestCase):
#----------------------------------Failure cases------------------------------------------------ #----------------------------------Failure cases------------------------------------------------
def test_bad_input(self): def test_bad_input(self):
masses = "test,bad,input" masses = ['test', 'bad', 'input']
amplitudes = "test,bad,input" amplitudes = ['test', 'bad', 'input']
self.assertRaises(RuntimeError, VesuvioThickness, Masses=masses, self.assertRaises(TypeError, VesuvioThickness, Masses=masses,
Amplitudes=amplitudes, Amplitudes=amplitudes,
DensityWorkspace='dens_tbl', DensityWorkspace='dens_tbl',
TransmissionWorkspace='trans_tbl') TransmissionWorkspace='trans_tbl')
def test_mismatch_mass_amplitude_inputs(self): def test_mismatch_mass_amplitude_inputs(self):
masses = '1.0,2.0,3.0,4.0' masses = [1.0, 2.0, 3.0, 4.0]
amplitudes = '1.0,2.0' amplitudes = [1.0, 2.0]
self.assertRaises(RuntimeError, VesuvioThickness, Masses=masses,
Amplitudes=amplitudes,
DensityWorkspace='dens_tbl',
TransmissionWorkspace='trans_tbl')
def test_no_masses_input(self):
masses = []
amplitudes =[1.0, 2.0]
self.assertRaises(RuntimeError, VesuvioThickness, Masses=masses,
Amplitudes=amplitudes,
DensityWorkspace='dens_tbl',
TransmissionWorkspace='trans_tbl')
def test_no_amplitudes_input(self):
masses = [1.0, 2.0]
amplitudes =[]
self.assertRaises(RuntimeError, VesuvioThickness, Masses=masses, self.assertRaises(RuntimeError, VesuvioThickness, Masses=masses,
Amplitudes=amplitudes, Amplitudes=amplitudes,
DensityWorkspace='dens_tbl', DensityWorkspace='dens_tbl',
......
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