- Timestamp:
- Nov 9, 2017 8:41:56 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:
- 4992ff2
- Parents:
- cee5c78
- git-author:
- Piotr Rozyczko <rozyczko@…> (10/27/17 08:49:35)
- git-committer:
- Piotr Rozyczko <rozyczko@…> (11/09/17 08:41:56)
- Location:
- src/sas/qtgui
- Files:
-
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Calculators/DataOperationUtilityPanel.py
rcee5c78 r7fb471d 273 273 msg = 'DataOperation: Number requires a float number' 274 274 logging.warning(msg) 275 self.txtNumber.setStyleSheet( QtCore.QString(BG_RED))275 self.txtNumber.setStyleSheet(BG_RED) 276 276 277 277 elif float(self.txtNumber.text()) == 0.: … … 279 279 msg = 'DataOperation: Number requires a non zero number' 280 280 logging.warning(msg) 281 self.txtNumber.setStyleSheet( QtCore.QString(BG_RED))281 self.txtNumber.setStyleSheet(BG_RED) 282 282 283 283 else: 284 self.txtNumber.setStyleSheet( QtCore.QString(BG_WHITE))284 self.txtNumber.setStyleSheet(BG_WHITE) 285 285 self.data2 = float(self.txtNumber.text()) 286 286 self.updatePlot(self.graphData2, self.layoutData2, self.data2) … … 293 293 else: 294 294 if self.cbData2.currentText() == 'Number': 295 self.cbData1.setStyleSheet( QtCore.QString(BG_WHITE))296 self.cbData2.setStyleSheet( QtCore.QString(BG_WHITE))295 self.cbData1.setStyleSheet(BG_WHITE) 296 self.cbData2.setStyleSheet(BG_WHITE) 297 297 return True 298 298 299 299 elif self.data1.__class__.__name__ != self.data2.__class__.__name__: 300 self.cbData1.setStyleSheet( QtCore.QString(BG_RED))301 self.cbData2.setStyleSheet( QtCore.QString(BG_RED))300 self.cbData1.setStyleSheet(BG_RED) 301 self.cbData2.setStyleSheet(BG_RED) 302 302 print(self.data1.__class__.__name__ != self.data2.__class__.__name__) 303 303 logging.warning('Cannot compute data of different dimensions') … … 308 308 not all(i == j for i, j in zip(self.data1.x, self.data2.x))): 309 309 logging.warning('Cannot compute 1D data of different lengths') 310 self.cbData1.setStyleSheet( QtCore.QString(BG_RED))311 self.cbData2.setStyleSheet( QtCore.QString(BG_RED))310 self.cbData1.setStyleSheet(BG_RED) 311 self.cbData2.setStyleSheet(BG_RED) 312 312 return False 313 313 … … 320 320 zip(self.data1.qy_data, self.data2.qy_data)) 321 321 ): 322 self.cbData1.setStyleSheet( QtCore.QString(BG_RED))323 self.cbData2.setStyleSheet( QtCore.QString(BG_RED))322 self.cbData1.setStyleSheet(BG_RED) 323 self.cbData2.setStyleSheet(BG_RED) 324 324 logging.warning('Cannot compute 2D data of different lengths') 325 325 return False 326 326 327 327 else: 328 self.cbData1.setStyleSheet( QtCore.QString(BG_WHITE))329 self.cbData2.setStyleSheet( QtCore.QString(BG_WHITE))328 self.cbData1.setStyleSheet(BG_WHITE) 329 self.cbData2.setStyleSheet(BG_WHITE) 330 330 return True 331 331 … … 333 333 """ Check that name of output does not already exist """ 334 334 name_to_check = str(self.txtOutputData.text()) 335 self.txtOutputData.setStyleSheet( QtCore.QString(BG_WHITE))335 self.txtOutputData.setStyleSheet(BG_WHITE) 336 336 337 337 if name_to_check is None or name_to_check == '': 338 self.txtOutputData.setStyleSheet( QtCore.QString(BG_RED))338 self.txtOutputData.setStyleSheet(BG_RED) 339 339 logging.warning('No output name') 340 340 return False 341 341 342 342 elif name_to_check in self.list_data_items: 343 self.txtOutputData.setStyleSheet( QtCore.QString(BG_RED))343 self.txtOutputData.setStyleSheet(BG_RED) 344 344 logging.warning('The Output data name already exists') 345 345 return False 346 346 347 347 else: 348 self.txtOutputData.setStyleSheet( QtCore.QString(BG_WHITE))348 self.txtOutputData.setStyleSheet(BG_WHITE) 349 349 return True 350 350 -
src/sas/qtgui/Calculators/GenericScatteringCalculator.py
- Property mode changed from 100755 to 100644
rb3e8629 r7fb471d 235 235 """Check range of text edits for QMax and Number of Qbins """ 236 236 text_edit = self.sender() 237 text_edit.setStyleSheet( 238 QtCore.QString.fromUtf8('background-color: rgb(255, 255, 255);')) 237 text_edit.setStyleSheet('background-color: rgb(255, 255, 255);') 239 238 if text_edit.text(): 240 239 value = float(str(text_edit.text())) 241 240 if text_edit == self.txtQxMax: 242 241 if value <= 0 or value > 1000: 243 text_edit.setStyleSheet(QtCore.QString.fromUtf8( 244 'background-color: rgb(255, 182, 193);')) 242 text_edit.setStyleSheet('background-color: rgb(255, 182, 193);') 245 243 else: 246 text_edit.setStyleSheet(QtCore.QString.fromUtf8( 247 'background-color: rgb(255, 255, 255);')) 244 text_edit.setStyleSheet('background-color: rgb(255, 255, 255);') 248 245 elif text_edit == self.txtNoQBins: 249 246 if value < 2 or value > 1000: 250 self.txtNoQBins.setStyleSheet(QtCore.QString.fromUtf8( 251 'background-color: rgb(255, 182, 193);')) 247 self.txtNoQBins.setStyleSheet('background-color: rgb(255, 182, 193);') 252 248 else: 253 self.txtNoQBins.setStyleSheet(QtCore.QString.fromUtf8( 254 'background-color: rgb(255, 255, 255);')) 249 self.txtNoQBins.setStyleSheet('background-color: rgb(255, 255, 255);') 255 250 256 251 def update_gui(self): … … 555 550 # Add deferred callback for call return 556 551 d.addCallback(self.plot_1_2d) 552 d.addErrback(self.calculateFailed) 557 553 except: 558 554 log_msg = "{}. stop".format(sys.exc_info()[1]) … … 564 560 Copied from previous version 565 561 """ 562 pass 563 564 def calculateFailed(self, reason): 565 """ 566 """ 567 print("Calculate Failed with:\n", reason) 566 568 pass 567 569 -
src/sas/qtgui/Calculators/ResolutionCalculatorPanel.py
- Property mode changed from 100755 to 100644
rb3e8629 r7fb471d 111 111 # call compute to calculate with default values 112 112 self.createTemplate2DPlot() 113 self.onCompute()113 #self.onCompute() 114 114 115 115 # ################################# … … 123 123 text_edit = self.txtWavelength # self.sender() 124 124 if text_edit.isModified(): 125 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))125 text_edit.setStyleSheet(BG_WHITE) 126 126 input_string = str(text_edit.text()) 127 127 if self.cbWaveColor.currentText() != 'TOF': 128 128 input_wavelength = re.match('\d+\.?\d*', input_string) 129 129 if input_wavelength is None: 130 text_edit.setStyleSheet( QtCore.QString(BG_RED))130 text_edit.setStyleSheet(BG_RED) 131 131 self.cmdCompute.setEnabled(False) 132 132 logging.info('Wavelength has to be a number.') 133 133 else: 134 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))134 text_edit.setStyleSheet(BG_WHITE) 135 135 self.cmdCompute.setEnabled(True) 136 136 else: … … 139 139 140 140 if interval_wavelength is None: 141 text_edit.setStyleSheet( QtCore.QString(BG_RED))141 text_edit.setStyleSheet(BG_RED) 142 142 self.cmdCompute.setEnabled(False) 143 143 logging.info("Wavelength's input has to be an interval: " … … 149 149 150 150 if float(wavelength_min) >= float(wavelength_max): 151 text_edit.setStyleSheet( QtCore.QString(BG_RED))151 text_edit.setStyleSheet(BG_RED) 152 152 self.cmdCompute.setEnabled(False) 153 153 logging.info("Wavelength: min must be smaller than max.") 154 154 155 155 else: 156 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))156 text_edit.setStyleSheet(BG_WHITE) 157 157 self.cmdCompute.setEnabled(True) 158 158 … … 163 163 164 164 if text_edit.isModified(): 165 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))165 text_edit.setStyleSheet(BG_WHITE) 166 166 if self.cbWaveColor.currentText() != 'TOF': 167 167 pattern = '^\d+\.?\d*(|;\s*\d+)$' … … 170 170 171 171 if wavelength_spread_input is None: 172 text_edit.setStyleSheet( QtCore.QString(BG_RED))172 text_edit.setStyleSheet(BG_RED) 173 173 self.cmdCompute.setEnabled(False) 174 174 logging.info('Wavelength spread has to be specified: ' … … 178 178 split_input = wavelength_spread_input.group().split(';') 179 179 self.num_wave = split_input[1] if len(split_input) > 1 else 10 180 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))180 text_edit.setStyleSheet(BG_WHITE) 181 181 self.cmdCompute.setEnabled(True) 182 182 else: … … 186 186 187 187 if wavelength_spread_input is None: 188 text_edit.setStyleSheet( QtCore.QString(BG_RED))188 text_edit.setStyleSheet(BG_RED) 189 189 self.cmdCompute.setEnabled(False) 190 190 logging.info("Wavelength spread has to be specified: " … … 197 197 self.num_wave = split_input[1] if len( 198 198 split_input) > 1 else 10 199 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))199 text_edit.setStyleSheet(BG_WHITE) 200 200 self.cmdCompute.setEnabled(True) 201 201 … … 205 205 206 206 if text_edit.isModified(): 207 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))207 text_edit.setStyleSheet(BG_WHITE) 208 208 pattern = '^\d+\.?\d*,\s*\d+\.?\d*$' 209 209 input_string = str(text_edit.text()) … … 211 211 212 212 if pixels_input is None: 213 text_edit.setStyleSheet( QtCore.QString(BG_RED))213 text_edit.setStyleSheet(BG_RED) 214 214 self.cmdCompute.setEnabled(False) 215 215 logging.info('The input for the detector should contain 2 ' … … 217 217 218 218 else: 219 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))219 text_edit.setStyleSheet(BG_WHITE) 220 220 self.cmdCompute.setEnabled(True) 221 221 … … 229 229 q_input = re.match(pattern, input_string) 230 230 if q_input is None: 231 text_edit.setStyleSheet( QtCore.QString(BG_RED))231 text_edit.setStyleSheet(BG_RED) 232 232 self.cmdCompute.setEnabled(False) 233 233 logging.info('Qx and Qy should contain one or more comma-separated numbers.') 234 234 else: 235 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))235 text_edit.setStyleSheet(BG_WHITE) 236 236 self.cmdCompute.setEnabled(True) 237 237 qx = str(self.txtQx.text()).split(',') … … 247 247 248 248 elif len(qx) != len(qy): 249 text_edit.setStyleSheet( QtCore.QString(BG_RED))249 text_edit.setStyleSheet(BG_RED) 250 250 self.cmdCompute.setEnabled(False) 251 251 logging.info( … … 253 253 254 254 else: 255 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))255 text_edit.setStyleSheet(BG_WHITE) 256 256 self.cmdCompute.setEnabled(True) 257 257 … … 261 261 262 262 if text_edit.isModified(): 263 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))263 text_edit.setStyleSheet(BG_WHITE) 264 264 input_string = str(text_edit.text()) 265 265 pattern = '^\d+\.?\d*(|,\s*\d+)$' … … 267 267 268 268 if aperture_input is None: 269 text_edit.setStyleSheet( QtCore.QString(BG_RED))269 text_edit.setStyleSheet(BG_RED) 270 270 self.cmdCompute.setEnabled(False) 271 271 logging.info('A circular aperture is defined by a single ' … … 274 274 275 275 else: 276 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))276 text_edit.setStyleSheet(BG_WHITE) 277 277 self.cmdCompute.setEnabled(True) 278 278 … … 524 524 525 525 cal_res.addCallback(self.complete) 526 cal_res.addErrback(self.calculateFailed) 526 527 527 528 # logging.info("Computation is in progress...") … … 531 532 raise 532 533 534 def calculateFailed(self, reason): 535 print("calculateFailed Failed with:\n", reason) 536 pass 537 533 538 def complete(self, image): 534 539 """ … … 562 567 : return: image (numpy array) 563 568 """ 569 # This fails in py3 with 570 # [Failure instance: Traceback: <class 'TypeError'>: 'map' object is not subscriptable 571 # INVESTIGATE 564 572 image = map(func, qx, qy, 565 573 qx_min, qx_max, -
src/sas/qtgui/Calculators/SldPanel.py
- Property mode changed from 100755 to 100644
-
src/sas/qtgui/Calculators/SlitSizeCalculator.py
- Property mode changed from 100755 to 100644
rb3e8629 r7fb471d 82 82 return 83 83 84 if isinstance(path, QtCore.QString):85 path = str(path)86 87 84 return path 88 85 -
src/sas/qtgui/Calculators/UnitTesting/DataOperationUtilityTest.py
r0c468bf r7fb471d 8 8 from PyQt4.QtTest import QTest 9 9 from PyQt4.QtCore import Qt 10 from mock import MagicMock11 from mock import patch10 from unittest.mock import MagicMock 11 from unittest.mock import patch 12 12 13 13 from twisted.internet import threads -
src/sas/qtgui/Calculators/UnitTesting/DensityCalculatorTest.py
r464cd07 r7fb471d 6 6 from PyQt4.QtTest import QTest 7 7 from PyQt4 import QtCore 8 from mock import MagicMock8 from unittest.mock import MagicMock 9 9 10 10 ####### TEMP -
src/sas/qtgui/Calculators/UnitTesting/GenericScatteringCalculatorTest.py
rf4a1433 r7fb471d 7 7 8 8 from PyQt4.QtCore import Qt 9 from mock import MagicMock10 from mock import patch9 from unittest.mock import MagicMock 10 from unittest.mock import patch 11 11 12 12 # set up import paths -
src/sas/qtgui/Calculators/UnitTesting/ResolutionCalculatorPanelTest.py
r170e95d r7fb471d 8 8 from PyQt4.QtTest import QTest 9 9 from PyQt4.QtCore import Qt 10 from mock import MagicMock 11 from mock import patch 10 from unittest.mock import MagicMock 12 11 13 12 from twisted.internet import threads -
src/sas/qtgui/Calculators/UnitTesting/SLDCalculatorTest.py
rf4a1433 r7fb471d 6 6 from PyQt4.QtTest import QTest 7 7 from PyQt4 import QtCore 8 from mock import MagicMock8 from unittest.mock import MagicMock 9 9 10 10 ####### TEMP -
src/sas/qtgui/Calculators/UnitTesting/SlitSizeCalculatorTest.py
- Property mode changed from 100755 to 100644
rb3e8629 r7fb471d 4 4 from PyQt4.QtTest import QTest 5 5 from PyQt4.QtCore import Qt 6 from mock import MagicMock6 from unittest.mock import MagicMock 7 7 8 8 # set up import paths -
src/sas/qtgui/MainWindow/DataExplorer.py
- Property mode changed from 100755 to 100644
rb3e8629 r7fb471d 175 175 load_thread = threads.deferToThread(self.readData, url) 176 176 load_thread.addCallback(self.loadComplete) 177 load_thread.addErrback(self.loadFailed) 177 178 178 179 def loadFile(self, event=None): … … 221 222 load_thread = threads.deferToThread(self.readProject, filename) 222 223 load_thread.addCallback(self.readProjectComplete) 224 load_thread.addErrback(self.readProjectFailed) 225 226 def readProjectFailed(self, reason): 227 """ 228 """ 229 print("readProjectFailed FAILED: ", reason) 230 pass 223 231 224 232 def readProject(self, filename): … … 614 622 return 615 623 616 #if isinstance(paths, QtCore.QStringList):617 # paths = [str(f) for f in paths]618 619 624 if not isinstance(paths, list): 620 625 paths = [paths] … … 992 997 self.manager.add_data(data_list=output_data) 993 998 999 def loadErrback(self, reason): 1000 print("File Load Failed with:\n", reason) 1001 pass 1002 994 1003 def updateModel(self, data, p_file): 995 1004 """ -
src/sas/qtgui/MainWindow/UnitTesting/AboutBoxTest.py
r464cd07 r7fb471d 6 6 from PyQt4.QtTest import QTest 7 7 from PyQt4 import QtCore 8 from mock import MagicMock8 from unittest.mock import MagicMock 9 9 10 10 # set up import paths -
src/sas/qtgui/MainWindow/UnitTesting/DataExplorerTest.py
- Property mode changed from 100644 to 100755
rf7d14a1 r7fb471d 5 5 from PyQt4.QtTest import QTest 6 6 from PyQt4.QtCore import * 7 from mock import MagicMock8 from mock import patch7 from unittest.mock import MagicMock 8 from unittest.mock import patch 9 9 from mpl_toolkits.mplot3d import Axes3D 10 10 … … 157 157 158 158 expected_list = [0, 0, 33, 66, -1] 159 spied_list = [spy_progress_bar_update.called()[i]['args'][0] for i in xrange(5)]159 spied_list = [spy_progress_bar_update.called()[i]['args'][0] for i in range(5)] 160 160 self.assertEqual(expected_list, spied_list) 161 161 … … 325 325 self.form.cbSelect.setCurrentIndex(1) 326 326 327 self.form.show() 328 app.exec_() 329 327 330 # Test the current selection 328 331 item1D = self.form.model.item(0) … … 503 506 # We don't know the data ID, so need to iterate over dict 504 507 data_dict = spy_data_received.called()[0]['args'][0] 505 for data_key, data_value in data_dict.ite ritems():508 for data_key, data_value in data_dict.items(): 506 509 self.assertIsInstance(data_value, Data1D) 507 510 -
src/sas/qtgui/MainWindow/UnitTesting/GuiManagerTest.py
- Property mode changed from 100644 to 100755
r8222f171 r7fb471d 9 9 from PyQt4.QtCore import * 10 10 from PyQt4.QtWebKit import * 11 from mock import MagicMock11 from unittest.mock import MagicMock 12 12 13 13 # set up import paths … … 74 74 # We are in the MainWindow scope, so simple 'print' will work 75 75 message = "from stdout" 76 print message76 print(message) 77 77 self.assertIn(message, self.manager.logDockWidget.widget().toPlainText()) 78 78 … … 162 162 """ 163 163 # 1. version = 0.0.0 164 version_info = { u'version' : u'0.0.0'}164 version_info = {'version' : '0.0.0'} 165 165 spy_status_update = QtSignalSpy(self.manager, self.manager.communicate.statusBarUpdateSignal) 166 166 … … 172 172 173 173 # 2. version < LocalConfig.__version__ 174 version_info = { u'version' : u'0.0.1'}174 version_info = {'version' : '0.0.1'} 175 175 spy_status_update = QtSignalSpy(self.manager, self.manager.communicate.statusBarUpdateSignal) 176 176 … … 182 182 183 183 # 3. version > LocalConfig.__version__ 184 version_info = { u'version' : u'999.0.0'}184 version_info = {'version' : '999.0.0'} 185 185 spy_status_update = QtSignalSpy(self.manager, self.manager.communicate.statusBarUpdateSignal) 186 186 webbrowser.open = MagicMock() -
src/sas/qtgui/MainWindow/UnitTesting/MainWindowTest.py
r464cd07 r7fb471d 5 5 from PyQt4 import QtTest 6 6 from PyQt4 import QtCore 7 from mock import MagicMock7 from unittest.mock import MagicMock 8 8 9 9 # set up import paths -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
rcee5c78 r7fb471d 572 572 model_row = item.row() 573 573 name_index = self._poly_model.index(model_row, 0) 574 parameter_name = str(name_index.data() .toString()).lower() # "distribution of sld" etc.574 parameter_name = str(name_index.data()).lower() # "distribution of sld" etc. 575 575 if "distribution of" in parameter_name: 576 576 # just the last word -
src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingLogicTest.py
r464cd07 r7fb471d 3 3 4 4 import numpy 5 from mock import MagicMock5 from unittest.mock import MagicMock 6 6 7 7 # set up import paths -
src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingOptionsTest.py
r464cd07 r7fb471d 6 6 from PyQt4 import QtWebKit 7 7 8 from mock import MagicMock8 from unittest.mock import MagicMock 9 9 10 10 # set up import paths -
src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingPerspectiveTest.py
r464cd07 r7fb471d 6 6 from PyQt4 import QtTest 7 7 from PyQt4 import QtCore 8 from mock import MagicMock8 from unittest.mock import MagicMock 9 9 10 10 # set up import paths -
src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingWidgetTest.py
- Property mode changed from 100644 to 100755
r9ea43c82 r7fb471d 6 6 from PyQt4 import QtTest 7 7 from PyQt4 import QtCore 8 from mock import MagicMock8 from unittest.mock import MagicMock 9 9 from twisted.internet import threads 10 10 … … 60 60 61 61 #Test loading from json categories 62 category_list = fittingWindow.master_category_dict.keys()62 category_list = list(fittingWindow.master_category_dict.keys()) 63 63 64 64 for category in category_list: … … 93 93 fittingWindow.SASModelToQModel("cylinder") 94 94 pd_index = fittingWindow.lstPoly.model().index(0,0) 95 self.assertEqual(str(pd_index.data() .toString()), "Distribution of radius")95 self.assertEqual(str(pd_index.data()), "Distribution of radius") 96 96 pd_index = fittingWindow.lstPoly.model().index(1,0) 97 self.assertEqual(str(pd_index.data() .toString()), "Distribution of length")97 self.assertEqual(str(pd_index.data()), "Distribution of length") 98 98 99 99 # test the delegate a bit … … 394 394 395 395 # Test presence of comboboxes in last column 396 for row in xrange(self.widget._poly_model.rowCount()):396 for row in range(self.widget._poly_model.rowCount()): 397 397 func_index = self.widget._poly_model.index(row, 6) 398 398 self.assertTrue(isinstance(self.widget.lstPoly.indexWidget(func_index), QtGui.QComboBox)) … … 542 542 543 543 # Test rows 544 for row in xrange(self.widget._magnet_model.rowCount()):544 for row in range(self.widget._magnet_model.rowCount()): 545 545 func_index = self.widget._magnet_model.index(row, 0) 546 546 self.assertIn(':', self.widget._magnet_model.item(row, 0).text()) … … 981 981 982 982 # check that range of variation for this parameter has NOT been changed 983 print self.widget.kernel_module.details[name_modified_param]983 print(self.widget.kernel_module.details[name_modified_param]) 984 984 self.assertNotIn(new_value, self.widget.kernel_module.details[name_modified_param] ) 985 985 -
src/sas/qtgui/Perspectives/Invariant/InvariantPerspective.py
rcee5c78 r7fb471d 180 180 # Add deferred callback for call return 181 181 d.addCallback(self.plotResult) 182 d.addErrback(self.plotFailed) 182 183 except Exception as ex: 183 184 # Set the button back to available … … 186 187 self.pushButton.setStyleSheet(self.style) 187 188 189 def plotFailed(self, reason): 190 """ 191 """ 192 print("plotFailed FAILED: ", reason) 193 pass 188 194 189 195 def plotResult(self, model): -
src/sas/qtgui/Plotting/UnitTesting/AddTextTest.py
r464cd07 r7fb471d 1 1 import sys 2 2 import unittest 3 from mock import MagicMock3 from unittest.mock import MagicMock 4 4 5 5 from PyQt4 import QtGui -
src/sas/qtgui/Plotting/UnitTesting/BoxSumTest.py
rcee5c78 r7fb471d 1 1 import sys 2 2 import unittest 3 from mock import MagicMock3 from unittest.mock import MagicMock 4 4 5 5 from PyQt4 import QtGui -
src/sas/qtgui/Plotting/UnitTesting/ColorMapTest.py
r464cd07 r7fb471d 4 4 5 5 from PyQt4 import QtGui 6 from mock import MagicMock6 from unittest.mock import MagicMock 7 7 import matplotlib as mpl 8 8 -
src/sas/qtgui/Plotting/UnitTesting/LinearFitTest.py
r464cd07 r7fb471d 4 4 5 5 from PyQt4 import QtGui 6 from mock import MagicMock6 from unittest.mock import MagicMock 7 7 8 8 # set up import paths … … 59 59 return_values = self.widget.parent.emit.call_args[0][1] 60 60 # Compare 61 self.assert ItemsEqual(return_values[0], [1.0, 3.0])61 self.assertCountEqual(return_values[0], [1.0, 3.0]) 62 62 self.assertAlmostEqual(return_values[1][0], 10.004054329, 6) 63 63 self.assertAlmostEqual(return_values[1][1], 12.030439848, 6) … … 68 68 return_values = self.widget.parent.emit.call_args[0][1] 69 69 # Compare 70 self.assert ItemsEqual(return_values[0], [1.0, 3.0])70 self.assertCountEqual(return_values[0], [1.0, 3.0]) 71 71 self.assertAlmostEqual(return_values[1][0], 9.987732937, 6) 72 72 self.assertAlmostEqual(return_values[1][1], 11.84365082, 6) … … 81 81 x, y, dy = self.widget.origData() 82 82 83 self.assert ItemsEqual(x, orig_x)83 self.assertCountEqual(x, orig_x) 84 84 self.assertEqual(y[0], orig_y[0]) 85 85 self.assertAlmostEqual(y[1], orig_y[1], 8) … … 98 98 x, y, dy = self.widget.origData() 99 99 100 self.assert ItemsEqual(x, orig_x)101 self.assert ItemsEqual(y, orig_y)102 self.assert ItemsEqual(dy, orig_dy)100 self.assertCountEqual(x, orig_x) 101 self.assertCountEqual(y, orig_y) 102 self.assertCountEqual(dy, orig_dy) 103 103 104 104 # x, log(y) … … 111 111 x, y, dy = self.widget.origData() 112 112 113 self.assert ItemsEqual(x, orig_x)113 self.assertCountEqual(x, orig_x) 114 114 self.assertEqual(y[0], orig_y[0]) 115 115 self.assertAlmostEqual(y[1], orig_y[1], 8) -
src/sas/qtgui/Plotting/UnitTesting/PlotPropertiesTest.py
r464cd07 r7fb471d 1 1 import sys 2 2 import unittest 3 from mock import MagicMock3 from unittest.mock import MagicMock 4 4 5 5 from PyQt4 import QtGui -
src/sas/qtgui/Plotting/UnitTesting/Plotter2DTest.py
rb2a5042 r7fb471d 7 7 from PyQt4 import QtCore 8 8 from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas 9 from mock import MagicMock9 from unittest.mock import MagicMock 10 10 from mpl_toolkits.mplot3d import Axes3D 11 11 -
src/sas/qtgui/Plotting/UnitTesting/PlotterBaseTest.py
rb2a5042 r7fb471d 2 2 import unittest 3 3 import platform 4 from mock import patch,MagicMock4 from unittest.mock import MagicMock 5 5 6 6 from PyQt4 import QtGui -
src/sas/qtgui/Plotting/UnitTesting/PlotterTest.py
- Property mode changed from 100644 to 100755
r749b715 r7fb471d 6 6 from PyQt4 import QtCore 7 7 from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas 8 from mock import MagicMock9 from mock import patch8 from unittest.mock import MagicMock 9 from unittest.mock import patch 10 10 11 11 ####### TEMP … … 257 257 258 258 # Just this one plot 259 self.assertEqual(len( self.plotter.plot_dict.keys()), 1)259 self.assertEqual(len(list(self.plotter.plot_dict.keys())), 1) 260 260 self.plotter.onLinearFit(1) 261 261 … … 281 281 282 282 # Assure we have two sets 283 self.assertEqual(len( self.plotter.plot_dict.keys()), 2)283 self.assertEqual(len(list(self.plotter.plot_dict.keys())), 2) 284 284 285 285 # Delete one set 286 286 self.plotter.onRemovePlot(2) 287 287 # Assure we have two sets 288 self.assertEqual(len( self.plotter.plot_dict.keys()), 1)288 self.assertEqual(len(list(self.plotter.plot_dict.keys())), 1) 289 289 290 290 self.plotter.manager = MagicMock() … … 293 293 self.plotter.onRemovePlot(1) 294 294 # Assure we have no plots 295 self.assertEqual(len( self.plotter.plot_dict.keys()), 0)295 self.assertEqual(len(list(self.plotter.plot_dict.keys())), 0) 296 296 # Assure the plotter window is closed 297 297 self.assertFalse(self.plotter.isVisible()) -
src/sas/qtgui/Plotting/UnitTesting/SlicerModelTest.py
r464cd07 r7fb471d 1 1 import sys 2 2 import unittest 3 from mock import MagicMock3 from unittest.mock import MagicMock 4 4 5 5 from PyQt4 import QtGui -
src/sas/qtgui/Plotting/UnitTesting/SlicerParametersTest.py
r464cd07 r7fb471d 1 1 import sys 2 2 import unittest 3 from mock import MagicMock3 from unittest.mock import MagicMock 4 4 5 5 from PyQt4 import QtGui … … 7 7 from PyQt4 import QtTest 8 8 from PyQt4 import QtWebKit 9 10 from mock import MagicMock11 9 12 10 # set up import paths -
src/sas/qtgui/UnitTesting/TestUtils.py
- Property mode changed from 100644 to 100755
rcee5c78 r7fb471d 10 10 """ 11 11 if method_name is not None: 12 print( "\nWARNING: %s needs implementing!"%method_name)12 print(("\nWARNING: %s needs implementing!"%method_name)) 13 13 else: 14 14 (frame, filename, line_number, 15 15 function_name, lines, index) = inspect.getouterframes(inspect.currentframe())[1] 16 print( "\nWARNING: %s needs implementing!"%function_name)16 print(("\nWARNING: %s needs implementing!"%function_name)) 17 17 18 18 class QtSignalSpy(QObject): … … 39 39 except AttributeError: 40 40 msg = "Wrong construction of QtSignalSpy instance" 41 raise RuntimeError , msg41 raise RuntimeError(msg) 42 42 43 43 def slot(self, *args, **kwargs): -
src/sas/qtgui/UnitTesting/TestUtilsTest.py
r464cd07 r7fb471d 5 5 from PyQt4.QtTest import QTest 6 6 from PyQt4.QtCore import * 7 from mock import MagicMock7 from unittest.mock import MagicMock 8 8 9 9 # Local -
src/sas/qtgui/Utilities/UnitTesting/GuiUtilsTest.py
rcee5c78 r7fb471d 5 5 from PyQt4 import QtCore 6 6 from PyQt4 import QtGui 7 from mock import MagicMock7 from unittest.mock import MagicMock 8 8 9 9 # set up import paths
Note: See TracChangeset
for help on using the changeset viewer.