Changeset 80468f6 in sasview for src/sas/qtgui/Perspectives


Ignore:
Timestamp:
May 7, 2018 6:43:54 AM (7 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
fca1f50
Parents:
b5cc06e
Message:

Fixed a few unit test files

Location:
src/sas/qtgui/Perspectives
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/Fitting/UnitTesting/ConstraintWidgetTest.py

    r3b3b40b r80468f6  
    3030            def communicator(self): 
    3131                return GuiUtils.Communicate() 
    32             def communicate(self): 
    33                 return GuiUtils.Communicate() 
     32            communicate = GuiUtils.Communicate() 
    3433 
    3534        '''Create the perspective''' 
    3635        self.perspective = FittingWindow(dummy_manager()) 
     36        ConstraintWidget.updateSignalsFromTab = MagicMock() 
    3737 
    3838        self.widget = ConstraintWidget(parent=self.perspective) 
  • src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingLogicTest.py

    r53c771e r80468f6  
    9898        data = Data1D(x=[1,2,3],y=[3,4,5]) 
    9999        data.name = "boop" 
     100        data.id = "poop" 
    100101        return_data = (data.x,data.y, 7, None, None, 
    101102                        0, True, 0.0, 1, data, 
     
    107108        self.assertFalse(new_plot.is_data) 
    108109        self.assertEqual(new_plot.dy.size, 3) 
    109         self.assertEqual(new_plot.title, "boop [boop]") 
    110         self.assertEqual(new_plot.name, "boop [boop]") 
     110        self.assertEqual(new_plot.title, "boop [poop]") 
     111        self.assertEqual(new_plot.name, "boop [poop]") 
    111112 
    112113    def testNew2DPlot(self): 
  • src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingPerspectiveTest.py

    r63319b0 r80468f6  
    2727            def communicator(self): 
    2828                return GuiUtils.Communicate() 
    29             def communicate(self): 
    30                 return GuiUtils.Communicate() 
     29            communicate = GuiUtils.Communicate() 
    3130 
    3231        '''Create the perspective''' 
     
    4544        self.assertEqual(len(self.widget.tabs), 1) 
    4645        self.assertEqual(self.widget.maxIndex, 1) 
    47         self.assertEqual(self.widget.maxCSIndex, 0) 
    4846        self.assertEqual(self.widget.getTabName(), "FitPage1") 
    4947 
     
    6664        self.widget.addConstraintTab() 
    6765        self.assertEqual(len(self.widget.tabs), 2) 
    68         self.assertEqual(self.widget.getCSTabName(), "Const. & Simul. Fit1") 
    69         self.assertEqual(self.widget.maxCSIndex, 1) 
     66        self.assertEqual(self.widget.getCSTabName(), "Const. & Simul. Fit") 
    7067 
    7168    def testResetTab(self): 
  • src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingWidgetTest.py

    r14ec91c5 r80468f6  
    181181 
    182182        # Observe no such luck 
    183         self.assertEqual(self.widget.cbCategory.currentIndex(), 6) 
     183        self.assertEqual(self.widget.cbCategory.currentIndex(), 7) 
    184184        self.assertEqual(self.widget.cbModel.count(), 29) 
    185185 
     
    737737 
    738738            # the fit button changed caption and got disabled 
    739             self.assertEqual(self.widget.cmdFit.text(), 'Running...') 
     739            self.assertEqual(self.widget.cmdFit.text(), 'Stop fit') 
    740740            self.assertFalse(self.widget.cmdFit.isEnabled()) 
    741741 
     
    781781 
    782782            # the fit button changed caption and got disabled 
    783             self.assertEqual(self.widget.cmdFit.text(), 'Running...') 
     783            self.assertEqual(self.widget.cmdFit.text(), 'Stop fit') 
    784784            self.assertFalse(self.widget.cmdFit.isEnabled()) 
    785785 
     
    12051205        # Assure the row has the constraint 
    12061206        self.assertEqual(self.widget.getConstraintForRow(row), const) 
    1207         # but not complex constraint! 
    1208         self.assertFalse(self.widget.rowHasConstraint(row)) 
     1207        self.assertTrue(self.widget.rowHasConstraint(row)) 
    12091208 
    12101209        # assign complex constraint now 
     
    12581257        self.assertEqual(spy.called()[1]['args'][0], [row2]) 
    12591258 
    1260         # Other properties 
    1261         self.assertEqual(self.widget.getConstraintsForModel(), [('background', '0.001'), ('radius', '20')]) 
    1262  
    12631259    def testDeleteConstraintOnParameter(self): 
    12641260        """ 
     
    12941290 
    12951291        # see that the other constraint is still present 
    1296         self.assertEqual(self.widget.getConstraintsForModel(), [('radius', '20')]) 
     1292        cons = self.widget.getConstraintForRow(4) # 4 = radius 
     1293        self.assertEqual(cons.param, "radius") 
     1294        self.assertEqual(cons.value, "20") 
    12971295 
    12981296        # kill the other constraint 
     
    13001298 
    13011299        # see that the other constraint is still present 
    1302         self.assertEqual(self.widget.getConstraintsForModel(), []) 
     1300        self.assertEqual(self.widget.getConstraintsForModel(), [('radius', None)]) 
    13031301 
    13041302    def testGetConstraintForRow(self): 
     
    14001398 
    14011399        # simple constraints 
    1402         self.assertEqual(self.widget.getConstraintsForModel(), [('background', '0.001'), ('radius', '20')]) 
     1400        # self.assertEqual(self.widget.getConstraintsForModel(), [('background', '0.001'), ('radius', '20')]) 
     1401        cons = self.widget.getConstraintForRow(1) # 1 - background 
     1402        self.assertEqual(cons.param, "background") 
     1403        self.assertEqual(cons.value, "0.001") 
     1404        cons = self.widget.getConstraintForRow(4) # 4 = radius 
     1405        self.assertEqual(cons.param, "radius") 
     1406        self.assertEqual(cons.value, "20") 
     1407 
    14031408        objects = self.widget.getConstraintObjectsForModel() 
    14041409        self.assertEqual(len(objects), 2) 
     
    14061411        self.assertEqual(objects[0].param, 'background') 
    14071412 
    1408  
    14091413        # add complex constraint 
    14101414        const = Constraint(parent=None, param='scale', func='5*sld') 
    14111415        row = 0 
    14121416        self.widget.addConstraintToRow(constraint=const, row=row) 
    1413         self.assertEqual(self.widget.getConstraintsForModel(),[('scale', '5*sld'), ('background', '0.001'), ('radius', '20')]) 
     1417        #self.assertEqual(self.widget.getConstraintsForModel(),[('scale', '5*sld'), ('background', '0.001'), ('radius', None)]) 
     1418        cons = self.widget.getConstraintForRow(4) # 4 = radius 
     1419        self.assertEqual(cons.param, "radius") 
     1420        self.assertEqual(cons.value, "20") 
     1421 
    14141422        objects = self.widget.getConstraintObjectsForModel() 
    14151423        self.assertEqual(len(objects), 3) 
  • src/sas/qtgui/Perspectives/Invariant/UnitTesting/InvariantPerspectiveTest.py

    • Property mode changed from 100755 to 100644
    r7c487846 r80468f6  
    9090        self.assertFalse(self.widget.txtPorodCst.isReadOnly()) 
    9191 
    92         self.assertFalse(self.widget.txtExtrapolQMin.isEnabled()) 
    93         self.assertFalse(self.widget.txtExtrapolQMax.isEnabled()) 
     92        self.assertTrue(self.widget.txtExtrapolQMin.isEnabled()) 
     93        self.assertTrue(self.widget.txtExtrapolQMax.isEnabled()) 
    9494 
    9595        self.assertFalse(self.widget.txtNptsLowQ.isReadOnly()) 
Note: See TracChangeset for help on using the changeset viewer.