Changeset 02ddfb4 in sasview for src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingWidgetTest.py
- Timestamp:
- May 3, 2017 7:56:24 AM (8 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:
- 56b22f9
- Parents:
- d48cc19
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingWidgetTest.py
rd48cc19 r02ddfb4 498 498 self.assertEqual(spy.count(), 1) 499 499 500 def testOnFit(self): 501 """ 502 Test the threaded fitting call 503 """ 504 # Set data 505 test_data = Data1D(x=[1,2], y=[1,2]) 506 507 # Force same data into logic 508 self.widget.logic.data = test_data 509 self.widget.data_is_loaded = True 510 category_index = self.widget.cbCategory.findText("Sphere") 511 self.widget.cbCategory.setCurrentIndex(category_index) 512 513 self.widget.show() 514 515 # Test no fitting params 516 self.widget.parameters_to_fit = [] 517 518 with self.assertRaises(ValueError) as error: 519 self.widget.onFit() 520 self.assertEqual(str(error.exception), 'no fitting parameters') 521 522 # Assing fitting params 523 self.widget.parameters_to_fit = ['scale'] 524 525 # Spying on status update signal 526 update_spy = QtSignalSpy(self.widget, self.widget.communicate.statusBarUpdateSignal) 527 528 with threads.deferToThread as MagicMock: 529 self.widget.onFit() 530 # thread called 531 self.assertTrue(threads.deferToThread.called) 532 # thread method is 'compute' 533 self.assertEqual(threads.deferToThread.call_args_list[0][0][0].__name__, 'compute') 534 535 # the fit button changed caption and got disabled 536 self.assertEqual(self.widget.cmdFit.text(), 'Calculating...') 537 self.assertFalse(self.widget.cmdFit.isEnabled()) 538 539 # Signal pushed up 540 self.assertEqual(update_spy.count(), 1) 541 500 542 501 543 if __name__ == "__main__":
Note: See TracChangeset
for help on using the changeset viewer.