Changeset da9a0722 in sasview


Ignore:
Timestamp:
Jan 30, 2018 6:00:39 AM (6 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:
5e66738
Parents:
63319b0
Message:

unit test updates

Location:
src/sas/qtgui
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/GUITests.py

    r676f137 rda9a0722  
    5757from Perspectives.Fitting.UnitTesting import FittingOptionsTest 
    5858from Perspectives.Fitting.UnitTesting import MultiConstraintTest 
     59from Perspectives.Fitting.UnitTesting import ComplexConstraintTest 
    5960from Perspectives.Fitting.UnitTesting import ConstraintWidgetTest 
    6061 
     
    118119        unittest.makeSuite(MultiConstraintTest.MultiConstraintTest,       'test'), 
    119120        unittest.makeSuite(ConstraintWidgetTest.ConstraintWidgetTest,     'test'), 
     121        unittest.makeSuite(ComplexConstraintTest.ComplexConstraintTest,   'test'), 
    120122 
    121123        #  Invariant 
  • src/sas/qtgui/Perspectives/Fitting/ComplexConstraint.py

    r0764593 rda9a0722  
    2222 
    2323        self.setupUi(self) 
    24         #self.setFixedSize(self.minimumSizeHint()) 
    2524        self.setModal(True) 
    2625 
     
    3433        self.setupWidgets() 
    3534        self.setupSignals() 
    36         #self.setupTooltip() 
     35        self.setupTooltip() 
    3736 
    3837        self.setFixedSize(self.minimumSizeHint()) 
     
    8685        Tooltip for txtConstraint 
    8786        """ 
    88         tooltip = "E.g.\n%s = 2.0 * (%s)\n" %(self.params[0], self.params[1]) 
    89         tooltip += "%s = sqrt(%s) + 5"%(self.params[0], self.params[1]) 
     87        p1 = self.tab_names[0] + ":" + self.cbParam1.currentText() 
     88        p2 = self.tab_names[1]+"."+self.cbParam2.currentText() 
     89        tooltip = "E.g.\n%s = 2.0 * (%s)\n" %(p1, p2) 
     90        tooltip += "%s = sqrt(%s) + 5"%(p1, p2) 
    9091        self.txtConstraint.setToolTip(tooltip) 
    9192 
     
    130131        self.cbParam2.setCurrentIndex(index1) 
    131132        self.cbOperator.setCurrentIndex(indexOp) 
    132         #self.setupTooltip() 
     133        self.setupTooltip() 
    133134 
    134135    def validateFormula(self): 
  • src/sas/qtgui/Perspectives/Fitting/ConstraintWidget.py

    r17968c3 rda9a0722  
    357357        Determines if the tab can be imported and included in the widget 
    358358        """ 
     359        if not isinstance(tab, str): return False 
    359360        if not self.currentType in tab: return False 
    360361        object = ObjectLibrary.getObject(tab) 
     
    396397        menu.addSeparator() 
    397398 
    398         #menu.addAction(self.actionRemoveConstraint) 
    399399        if num_rows >= 2: 
    400400            menu.addAction(self.actionMutualMultiConstrain) 
    401401 
    402402        # Define the callbacks 
    403         #self.actionConstrain.triggered.connect(self.addSimpleConstraint) 
    404         #self.actionRemoveConstraint.triggered.connect(self.deleteConstraint) 
    405403        self.actionMutualMultiConstrain.triggered.connect(self.showMultiConstraint) 
    406404        self.actionSelect.triggered.connect(self.selectModels) 
     
    443441 
    444442        # Define the callbacks 
    445         #self.actionConstrain.triggered.connect(self.addSimpleConstraint) 
    446443        self.actionRemoveConstraint.triggered.connect(self.deleteConstraint) 
    447         #self.actionMutualMultiConstrain.triggered.connect(self.showMultiConstraint) 
    448444        self.actionSelect.triggered.connect(self.selectConstraints) 
    449445        self.actionDeselect.triggered.connect(self.deselectConstraints) 
  • src/sas/qtgui/Perspectives/Fitting/UnitTesting/MultiConstraintTest.py

    • Property mode changed from 100755 to 100644
    r0595bb7 rda9a0722  
    22import unittest 
    33import numpy as np 
     4import webbrowser 
    45 
    56from unittest.mock import MagicMock 
     
    9899        # log10(    p2    ) +  p2 
    99100        self.assertTrue(self.widget.validateConstraint("log10(    p2    ) +  p2  ")) 
     101 
     102    def testOnHelp(self): 
     103        """ 
     104        Test the default help renderer 
     105        """ 
     106        webbrowser.open = MagicMock() 
     107 
     108        # invoke the tested method 
     109        self.widget.onHelp() 
     110 
     111        # see that webbrowser open was attempted 
     112        webbrowser.open.assert_called_once() 
Note: See TracChangeset for help on using the changeset viewer.