Changeset 80468f6 in sasview for src/sas/qtgui/Perspectives/Fitting
- Timestamp:
- May 7, 2018 6:43:54 AM (7 years ago)
- 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
- Location:
- src/sas/qtgui/Perspectives/Fitting/UnitTesting
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/UnitTesting/ConstraintWidgetTest.py
r3b3b40b r80468f6 30 30 def communicator(self): 31 31 return GuiUtils.Communicate() 32 def communicate(self): 33 return GuiUtils.Communicate() 32 communicate = GuiUtils.Communicate() 34 33 35 34 '''Create the perspective''' 36 35 self.perspective = FittingWindow(dummy_manager()) 36 ConstraintWidget.updateSignalsFromTab = MagicMock() 37 37 38 38 self.widget = ConstraintWidget(parent=self.perspective) -
src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingLogicTest.py
r53c771e r80468f6 98 98 data = Data1D(x=[1,2,3],y=[3,4,5]) 99 99 data.name = "boop" 100 data.id = "poop" 100 101 return_data = (data.x,data.y, 7, None, None, 101 102 0, True, 0.0, 1, data, … … 107 108 self.assertFalse(new_plot.is_data) 108 109 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]") 111 112 112 113 def testNew2DPlot(self): -
src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingPerspectiveTest.py
r63319b0 r80468f6 27 27 def communicator(self): 28 28 return GuiUtils.Communicate() 29 def communicate(self): 30 return GuiUtils.Communicate() 29 communicate = GuiUtils.Communicate() 31 30 32 31 '''Create the perspective''' … … 45 44 self.assertEqual(len(self.widget.tabs), 1) 46 45 self.assertEqual(self.widget.maxIndex, 1) 47 self.assertEqual(self.widget.maxCSIndex, 0)48 46 self.assertEqual(self.widget.getTabName(), "FitPage1") 49 47 … … 66 64 self.widget.addConstraintTab() 67 65 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") 70 67 71 68 def testResetTab(self): -
src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingWidgetTest.py
r14ec91c5 r80468f6 181 181 182 182 # Observe no such luck 183 self.assertEqual(self.widget.cbCategory.currentIndex(), 6)183 self.assertEqual(self.widget.cbCategory.currentIndex(), 7) 184 184 self.assertEqual(self.widget.cbModel.count(), 29) 185 185 … … 737 737 738 738 # 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') 740 740 self.assertFalse(self.widget.cmdFit.isEnabled()) 741 741 … … 781 781 782 782 # 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') 784 784 self.assertFalse(self.widget.cmdFit.isEnabled()) 785 785 … … 1205 1205 # Assure the row has the constraint 1206 1206 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)) 1209 1208 1210 1209 # assign complex constraint now … … 1258 1257 self.assertEqual(spy.called()[1]['args'][0], [row2]) 1259 1258 1260 # Other properties1261 self.assertEqual(self.widget.getConstraintsForModel(), [('background', '0.001'), ('radius', '20')])1262 1263 1259 def testDeleteConstraintOnParameter(self): 1264 1260 """ … … 1294 1290 1295 1291 # 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") 1297 1295 1298 1296 # kill the other constraint … … 1300 1298 1301 1299 # see that the other constraint is still present 1302 self.assertEqual(self.widget.getConstraintsForModel(), [ ])1300 self.assertEqual(self.widget.getConstraintsForModel(), [('radius', None)]) 1303 1301 1304 1302 def testGetConstraintForRow(self): … … 1400 1398 1401 1399 # 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 1403 1408 objects = self.widget.getConstraintObjectsForModel() 1404 1409 self.assertEqual(len(objects), 2) … … 1406 1411 self.assertEqual(objects[0].param, 'background') 1407 1412 1408 1409 1413 # add complex constraint 1410 1414 const = Constraint(parent=None, param='scale', func='5*sld') 1411 1415 row = 0 1412 1416 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 1414 1422 objects = self.widget.getConstraintObjectsForModel() 1415 1423 self.assertEqual(len(objects), 3)
Note: See TracChangeset
for help on using the changeset viewer.