Changeset 80468f6 in sasview for src/sas/qtgui/Utilities/UnitTesting


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/Utilities/UnitTesting
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Utilities/UnitTesting/GridPanelTest.py

    rd4dac80 r80468f6  
    1616 
    1717from sas.sascalc.fit.AbstractFitEngine import FResult 
     18from sas.sascalc.fit.AbstractFitEngine import FitData1D 
    1819from sasmodels.sasview_model import load_standard_models 
    1920from sas.qtgui.Plotting.PlotterData import Data1D 
     
    3233        # dummy perspective 
    3334        class dummy_manager(object): 
     35            _parent = QtWidgets.QWidget() 
    3436            def communicator(self): 
    3537                return GuiUtils.Communicate() 
     
    5658        self.assertIsNotNone(m) 
    5759        data = Data1D(x=[1,2], y=[3,4], dx=[0.1, 0.1], dy=[0.,0.]) 
     60        fit_data = FitData1D(x=[1,2], y=[3,4], data=data) 
    5861        param_list = ['sld_shell', 'sld_solvent'] 
    59         output = FResult(model=model, data=data, param_list=param_list) 
     62        output = FResult(model=model, data=fit_data, param_list=param_list) 
     63        output.sas_data = data 
    6064        output.theory = np.array([0.1,0.2]) 
    6165        output.pvec = np.array([0.1, 0.02]) 
     
    6367        output.fitness = 9000.0 
    6468        output.fitter_id = 200 
     69        output.stderr = [0.001, 0.001] 
    6570        output_data = [[output],[output]] 
    6671        return output_data 
  • src/sas/qtgui/Utilities/UnitTesting/PluginDefinitionTest.py

    • Property mode changed from 100755 to 100644
    r3b3b40b r80468f6  
    1616from sas.qtgui.Utilities.PythonSyntax import PythonHighlighter 
    1717 
    18 #if not QApplication.instance(): 
    19 #    app = QApplication(sys.argv) 
    20 app = QApplication(sys.argv) 
     18if not QApplication.instance(): 
     19    app = QApplication(sys.argv) 
    2120 
    2221class PluginDefinitionTest(unittest.TestCase): 
  • src/sas/qtgui/Utilities/UnitTesting/TabbedModelEditorTest.py

    • Property mode changed from 100755 to 100644
    r3b3b40b r80468f6  
    1616 
    1717# Local 
     18import sas.qtgui.Utilities.GuiUtils as GuiUtils 
    1819from sas.qtgui.Utilities.TabbedModelEditor import TabbedModelEditor 
    1920from sas.qtgui.Utilities.PluginDefinition import PluginDefinition 
     
    2122 
    2223 
    23 #if not QApplication.instance(): 
    24 #    app = QApplication(sys.argv) 
    25 app = QApplication(sys.argv) 
     24if not QApplication.instance(): 
     25    app = QApplication(sys.argv) 
    2626 
    2727class TabbedModelEditorTest(unittest.TestCase): 
     
    3030        Prepare the editors 
    3131        """ 
    32         self.widget = TabbedModelEditor(None) 
    33         self.widget_edit = TabbedModelEditor(None, edit_only=True) 
     32        class dummy_manager(object): 
     33            _parent = QWidget() 
     34            communicate = GuiUtils.Communicate() 
     35 
     36        self.widget = TabbedModelEditor(parent=dummy_manager) 
     37        self.widget_edit = TabbedModelEditor(parent=dummy_manager, edit_only=True) 
    3438 
    3539    def tearDown(self): 
     
    139143 
    140144 
    141     def testPluginModelModified(self): 
     145    def testpluginTitleSet(self): 
    142146        """Test reaction to direct edit in plugin wizard""" 
    143147        self.assertFalse(self.widget.is_modified) 
    144148 
    145149        # Call the tested method with no filename defined 
    146         self.widget.pluginModelModified() 
     150        self.widget.pluginTitleSet() 
    147151 
    148152        # Assure the apply button is disabled 
     
    157161        self.assertIn("*", self.widget.windowTitle()) 
    158162        self.assertIn(new_name, self.widget.windowTitle()) 
    159         self.assertTrue(self.widget.editor_widget.isEnabled()) 
    160163        self.assertTrue(self.widget.buttonBox.button(QDialogButtonBox.Apply).isEnabled()) 
    161164        self.assertTrue(self.widget.is_modified) 
Note: See TracChangeset for help on using the changeset viewer.