Changeset 88d2e70 in sasview for test/calculatorview


Ignore:
Timestamp:
Oct 11, 2018 2:03:40 PM (6 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1249
Children:
7c4bb4d
Parents:
e090ba90
Message:

support for py37 in unit tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/calculatorview/test/utest_gui_sld.py

    r959eb01 r88d2e70  
    3333        self.sld_frame.panel.ProcessEvent(clickEvent) 
    3434        bkg = self.sld_frame.panel.compound_ctl.GetBackgroundColour() 
    35         self.assert_(bkg.GetAsString() == 'pink') 
     35        self.assertTrue(bkg.GetAsString() == 'pink') 
    3636        #compute invariant without entering a value for compound 
    3737        self.sld_frame.panel.compound_ctl.SetValue("") 
     
    3939        self.sld_frame.panel.ProcessEvent(clickEvent) 
    4040        bkg = self.sld_frame.panel.compound_ctl.GetBackgroundColour() 
    41         self.assert_(bkg.GetAsString() == 'pink') 
     41        self.assertTrue(bkg.GetAsString() == 'pink') 
    4242        #compute invariant without entering a value for compound 
    4343        self.sld_frame.panel.compound_ctl.SetValue("H2O") 
     
    4545        self.sld_frame.panel.ProcessEvent(clickEvent) 
    4646        bkg = self.sld_frame.panel.compound_ctl.GetBackgroundColour() 
    47         self.assert_(bkg.GetAsString() == 'white') 
     47        self.assertTrue(bkg.GetAsString() == 'white') 
    4848        
    4949    def testDensityTextCtrl(self): 
     
    5959        self.sld_frame.panel.ProcessEvent(clickEvent) 
    6060        bkg = self.sld_frame.panel.density_ctl.GetBackgroundColour() 
    61         self.assert_(bkg.GetAsString() == 'pink') 
     61        self.assertTrue(bkg.GetAsString() == 'pink') 
    6262        #compute invariant without entering a value for density 
    6363        self.sld_frame.panel.compound_ctl.SetValue("H2O") 
     
    6565        self.sld_frame.panel.ProcessEvent(clickEvent) 
    6666        bkg = self.sld_frame.panel.density_ctl.GetBackgroundColour() 
    67         self.assert_(bkg.GetAsString() == 'pink') 
     67        self.assertTrue(bkg.GetAsString() == 'pink') 
    6868        #compute invariant without entering a value for density 
    6969        self.sld_frame.panel.compound_ctl.SetValue("H2O") 
     
    7171        self.sld_frame.panel.ProcessEvent(clickEvent) 
    7272        bkg = self.sld_frame.panel.density_ctl.GetBackgroundColour() 
    73         self.assert_(bkg.GetAsString() == 'white') 
     73        self.assertTrue(bkg.GetAsString() == 'white') 
    7474         
    7575    def testWavelengthTextCtrl(self): 
     
    8686        self.sld_frame.panel.ProcessEvent(clickEvent) 
    8787        bkg = self.sld_frame.panel.wavelength_ctl.GetBackgroundColour() 
    88         self.assert_(bkg.GetAsString() == 'pink') 
     88        self.assertTrue(bkg.GetAsString() == 'pink') 
    8989        #compute invariant without entering a value for wavelegnth 
    9090        self.sld_frame.panel.compound_ctl.SetValue("H2O") 
     
    9393        self.sld_frame.panel.ProcessEvent(clickEvent) 
    9494        cp_bkg = self.sld_frame.panel.compound_ctl.GetBackgroundColour() 
    95         self.assert_(cp_bkg.GetAsString() == 'white') 
     95        self.assertTrue(cp_bkg.GetAsString() == 'white') 
    9696        ds_bkg = self.sld_frame.panel.density_ctl.GetBackgroundColour() 
    97         self.assert_(ds_bkg.GetAsString() == 'white') 
     97        self.assertTrue(ds_bkg.GetAsString() == 'white') 
    9898        wv_bkg = self.sld_frame.panel.wavelength_ctl.GetBackgroundColour() 
    9999        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) 
    102102        sld_real = self.sld_frame.panel.neutron_sld_real_ctl.GetValue() 
    103103        sld_im = self.sld_frame.panel.neutron_sld_im_ctl.GetValue() 
     
    110110        length = self.sld_frame.panel.neutron_length_ctl.GetValue() 
    111111         
    112         self.assertAlmostEquals(float(sld_real), 1.04e-6, 1) 
    113         self.assertAlmostEquals(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) 
    114114        #test absorption value 
    115         self.assertAlmostEquals(float(abs) , 0.0741, 2) 
    116         self.assertAlmostEquals(float(incoh), 5.62, 2) 
     115        self.assertAlmostEqual(float(abs) , 0.0741, 2) 
     116        self.assertAlmostEqual(float(incoh), 5.62, 2) 
    117117        #Test length 
    118         self.assertAlmostEquals(float(length), 0.1755, 2) 
     118        self.assertAlmostEqual(float(length), 0.1755, 2) 
    119119        #test Cu sld 
    120         self.assertAlmostEquals(float(cu_real), 9.46e-6, 1) 
    121         self.assertAlmostEquals(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) 
    122122        # test Mo sld 
    123         self.assertAlmostEquals(float(mo_real), 9.43e-6) 
    124         self.assertAlmostEquals(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) 
    125125        #compute invariant with all correct inputs value 
    126126        self.sld_frame.panel.compound_ctl.SetValue("H2O") 
     
    130130        bkg = self.sld_frame.panel.wavelength_ctl.GetBackgroundColour() 
    131131        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) 
    134134         
    135135    def testSomeCombination(self): 
     
    145145        self.sld_frame.panel.ProcessEvent(clickEvent) 
    146146        cp_bkg = self.sld_frame.panel.compound_ctl.GetBackgroundColour() 
    147         self.assert_(cp_bkg.GetAsString() == 'white') 
     147        self.assertTrue(cp_bkg.GetAsString() == 'white') 
    148148        ds_bkg = self.sld_frame.panel.density_ctl.GetBackgroundColour() 
    149         self.assert_(ds_bkg.GetAsString() == 'white') 
     149        self.assertTrue(ds_bkg.GetAsString() == 'white') 
    150150        wv_bkg = self.sld_frame.panel.wavelength_ctl.GetBackgroundColour() 
    151         self.assert_(wv_bkg.GetAsString() == 'pink') 
     151        self.assertTrue(wv_bkg.GetAsString() == 'pink') 
    152152        #density, wavelength is invalid 
    153153        self.sld_frame.panel.compound_ctl.SetValue("H2O") 
     
    158158        self.sld_frame.panel.ProcessEvent(clickEvent) 
    159159        cp_bkg = self.sld_frame.panel.compound_ctl.GetBackgroundColour() 
    160         self.assert_(cp_bkg.GetAsString() == 'white') 
     160        self.assertTrue(cp_bkg.GetAsString() == 'white') 
    161161        ds_bkg = self.sld_frame.panel.density_ctl.GetBackgroundColour() 
    162         self.assert_(ds_bkg.GetAsString() == 'pink') 
     162        self.assertTrue(ds_bkg.GetAsString() == 'pink') 
    163163        wv_bkg = self.sld_frame.panel.wavelength_ctl.GetBackgroundColour() 
    164         self.assert_(wv_bkg.GetAsString() == 'pink') 
     164        self.assertTrue(wv_bkg.GetAsString() == 'pink') 
    165165        #density, wavelength is invalid 
    166166        self.sld_frame.panel.compound_ctl.SetValue("invalid compound") 
     
    171171        self.sld_frame.panel.ProcessEvent(clickEvent) 
    172172        cp_bkg = self.sld_frame.panel.compound_ctl.GetBackgroundColour() 
    173         self.assert_(cp_bkg.GetAsString() == 'pink') 
     173        self.assertTrue(cp_bkg.GetAsString() == 'pink') 
    174174        ds_bkg = self.sld_frame.panel.density_ctl.GetBackgroundColour() 
    175         self.assert_(ds_bkg.GetAsString() == 'pink') 
     175        self.assertTrue(ds_bkg.GetAsString() == 'pink') 
    176176        wv_bkg = self.sld_frame.panel.wavelength_ctl.GetBackgroundColour() 
    177         self.assert_(wv_bkg.GetAsString() == 'white') 
     177        self.assertTrue(wv_bkg.GetAsString() == 'white') 
    178178        value = self.sld_frame.panel.wavelength_ctl.GetValue() 
    179         self.assert_(float(value) == WAVELENGTH) 
     179        self.assertTrue(float(value) == WAVELENGTH) 
    180180 
    181181         
Note: See TracChangeset for help on using the changeset viewer.