Changeset 88d2e70 in sasview for test/calculatorview
- Timestamp:
- Oct 11, 2018 2:03:40 PM (6 years ago)
- Branches:
- master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1249
- Children:
- 7c4bb4d
- Parents:
- e090ba90
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
test/calculatorview/test/utest_gui_sld.py
r959eb01 r88d2e70 33 33 self.sld_frame.panel.ProcessEvent(clickEvent) 34 34 bkg = self.sld_frame.panel.compound_ctl.GetBackgroundColour() 35 self.assert _(bkg.GetAsString() == 'pink')35 self.assertTrue(bkg.GetAsString() == 'pink') 36 36 #compute invariant without entering a value for compound 37 37 self.sld_frame.panel.compound_ctl.SetValue("") … … 39 39 self.sld_frame.panel.ProcessEvent(clickEvent) 40 40 bkg = self.sld_frame.panel.compound_ctl.GetBackgroundColour() 41 self.assert _(bkg.GetAsString() == 'pink')41 self.assertTrue(bkg.GetAsString() == 'pink') 42 42 #compute invariant without entering a value for compound 43 43 self.sld_frame.panel.compound_ctl.SetValue("H2O") … … 45 45 self.sld_frame.panel.ProcessEvent(clickEvent) 46 46 bkg = self.sld_frame.panel.compound_ctl.GetBackgroundColour() 47 self.assert _(bkg.GetAsString() == 'white')47 self.assertTrue(bkg.GetAsString() == 'white') 48 48 49 49 def testDensityTextCtrl(self): … … 59 59 self.sld_frame.panel.ProcessEvent(clickEvent) 60 60 bkg = self.sld_frame.panel.density_ctl.GetBackgroundColour() 61 self.assert _(bkg.GetAsString() == 'pink')61 self.assertTrue(bkg.GetAsString() == 'pink') 62 62 #compute invariant without entering a value for density 63 63 self.sld_frame.panel.compound_ctl.SetValue("H2O") … … 65 65 self.sld_frame.panel.ProcessEvent(clickEvent) 66 66 bkg = self.sld_frame.panel.density_ctl.GetBackgroundColour() 67 self.assert _(bkg.GetAsString() == 'pink')67 self.assertTrue(bkg.GetAsString() == 'pink') 68 68 #compute invariant without entering a value for density 69 69 self.sld_frame.panel.compound_ctl.SetValue("H2O") … … 71 71 self.sld_frame.panel.ProcessEvent(clickEvent) 72 72 bkg = self.sld_frame.panel.density_ctl.GetBackgroundColour() 73 self.assert _(bkg.GetAsString() == 'white')73 self.assertTrue(bkg.GetAsString() == 'white') 74 74 75 75 def testWavelengthTextCtrl(self): … … 86 86 self.sld_frame.panel.ProcessEvent(clickEvent) 87 87 bkg = self.sld_frame.panel.wavelength_ctl.GetBackgroundColour() 88 self.assert _(bkg.GetAsString() == 'pink')88 self.assertTrue(bkg.GetAsString() == 'pink') 89 89 #compute invariant without entering a value for wavelegnth 90 90 self.sld_frame.panel.compound_ctl.SetValue("H2O") … … 93 93 self.sld_frame.panel.ProcessEvent(clickEvent) 94 94 cp_bkg = self.sld_frame.panel.compound_ctl.GetBackgroundColour() 95 self.assert _(cp_bkg.GetAsString() == 'white')95 self.assertTrue(cp_bkg.GetAsString() == 'white') 96 96 ds_bkg = self.sld_frame.panel.density_ctl.GetBackgroundColour() 97 self.assert _(ds_bkg.GetAsString() == 'white')97 self.assertTrue(ds_bkg.GetAsString() == 'white') 98 98 wv_bkg = self.sld_frame.panel.wavelength_ctl.GetBackgroundColour() 99 99 value = self.sld_frame.panel.wavelength_ctl.GetValue() 100 self.assert _(wv_bkg.GetAsString() == 'white')101 self.assert _(float(value) == WAVELENGTH)100 self.assertTrue(wv_bkg.GetAsString() == 'white') 101 self.assertTrue(float(value) == WAVELENGTH) 102 102 sld_real = self.sld_frame.panel.neutron_sld_real_ctl.GetValue() 103 103 sld_im = self.sld_frame.panel.neutron_sld_im_ctl.GetValue() … … 110 110 length = self.sld_frame.panel.neutron_length_ctl.GetValue() 111 111 112 self.assertAlmostEqual s(float(sld_real), 1.04e-6, 1)113 self.assertAlmostEqual s(float(sld_im), -1.5e-7, 1)112 self.assertAlmostEqual(float(sld_real), 1.04e-6, 1) 113 self.assertAlmostEqual(float(sld_im), -1.5e-7, 1) 114 114 #test absorption value 115 self.assertAlmostEqual s(float(abs) , 0.0741, 2)116 self.assertAlmostEqual s(float(incoh), 5.62, 2)115 self.assertAlmostEqual(float(abs) , 0.0741, 2) 116 self.assertAlmostEqual(float(incoh), 5.62, 2) 117 117 #Test length 118 self.assertAlmostEqual s(float(length), 0.1755, 2)118 self.assertAlmostEqual(float(length), 0.1755, 2) 119 119 #test Cu sld 120 self.assertAlmostEqual s(float(cu_real), 9.46e-6, 1)121 self.assertAlmostEqual s(float(cu_im), 3.01e-8)120 self.assertAlmostEqual(float(cu_real), 9.46e-6, 1) 121 self.assertAlmostEqual(float(cu_im), 3.01e-8) 122 122 # test Mo sld 123 self.assertAlmostEqual s(float(mo_real), 9.43e-6)124 self.assertAlmostEqual s(float(mo_im), 5.65e-7, 1)123 self.assertAlmostEqual(float(mo_real), 9.43e-6) 124 self.assertAlmostEqual(float(mo_im), 5.65e-7, 1) 125 125 #compute invariant with all correct inputs value 126 126 self.sld_frame.panel.compound_ctl.SetValue("H2O") … … 130 130 bkg = self.sld_frame.panel.wavelength_ctl.GetBackgroundColour() 131 131 value = self.sld_frame.panel.wavelength_ctl.GetValue() 132 self.assert _(bkg.GetAsString() == 'white')133 self.assert _(float(value) == WAVELENGTH/2)132 self.assertTrue(bkg.GetAsString() == 'white') 133 self.assertTrue(float(value) == WAVELENGTH/2) 134 134 135 135 def testSomeCombination(self): … … 145 145 self.sld_frame.panel.ProcessEvent(clickEvent) 146 146 cp_bkg = self.sld_frame.panel.compound_ctl.GetBackgroundColour() 147 self.assert _(cp_bkg.GetAsString() == 'white')147 self.assertTrue(cp_bkg.GetAsString() == 'white') 148 148 ds_bkg = self.sld_frame.panel.density_ctl.GetBackgroundColour() 149 self.assert _(ds_bkg.GetAsString() == 'white')149 self.assertTrue(ds_bkg.GetAsString() == 'white') 150 150 wv_bkg = self.sld_frame.panel.wavelength_ctl.GetBackgroundColour() 151 self.assert _(wv_bkg.GetAsString() == 'pink')151 self.assertTrue(wv_bkg.GetAsString() == 'pink') 152 152 #density, wavelength is invalid 153 153 self.sld_frame.panel.compound_ctl.SetValue("H2O") … … 158 158 self.sld_frame.panel.ProcessEvent(clickEvent) 159 159 cp_bkg = self.sld_frame.panel.compound_ctl.GetBackgroundColour() 160 self.assert _(cp_bkg.GetAsString() == 'white')160 self.assertTrue(cp_bkg.GetAsString() == 'white') 161 161 ds_bkg = self.sld_frame.panel.density_ctl.GetBackgroundColour() 162 self.assert _(ds_bkg.GetAsString() == 'pink')162 self.assertTrue(ds_bkg.GetAsString() == 'pink') 163 163 wv_bkg = self.sld_frame.panel.wavelength_ctl.GetBackgroundColour() 164 self.assert _(wv_bkg.GetAsString() == 'pink')164 self.assertTrue(wv_bkg.GetAsString() == 'pink') 165 165 #density, wavelength is invalid 166 166 self.sld_frame.panel.compound_ctl.SetValue("invalid compound") … … 171 171 self.sld_frame.panel.ProcessEvent(clickEvent) 172 172 cp_bkg = self.sld_frame.panel.compound_ctl.GetBackgroundColour() 173 self.assert _(cp_bkg.GetAsString() == 'pink')173 self.assertTrue(cp_bkg.GetAsString() == 'pink') 174 174 ds_bkg = self.sld_frame.panel.density_ctl.GetBackgroundColour() 175 self.assert _(ds_bkg.GetAsString() == 'pink')175 self.assertTrue(ds_bkg.GetAsString() == 'pink') 176 176 wv_bkg = self.sld_frame.panel.wavelength_ctl.GetBackgroundColour() 177 self.assert _(wv_bkg.GetAsString() == 'white')177 self.assertTrue(wv_bkg.GetAsString() == 'white') 178 178 value = self.sld_frame.panel.wavelength_ctl.GetValue() 179 self.assert _(float(value) == WAVELENGTH)179 self.assertTrue(float(value) == WAVELENGTH) 180 180 181 181
Note: See TracChangeset
for help on using the changeset viewer.