Changeset 7fb471d in sasview for src/sas/qtgui/Plotting/UnitTesting


Ignore:
Timestamp:
Nov 9, 2017 8:41:56 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:
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)
Message:

Update for unit tests and minor functionality quirks

Location:
src/sas/qtgui/Plotting/UnitTesting
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Plotting/UnitTesting/AddTextTest.py

    r464cd07 r7fb471d  
    11import sys 
    22import unittest 
    3 from mock import MagicMock 
     3from unittest.mock import MagicMock 
    44 
    55from PyQt4 import QtGui 
  • src/sas/qtgui/Plotting/UnitTesting/BoxSumTest.py

    rcee5c78 r7fb471d  
    11import sys 
    22import unittest 
    3 from mock import MagicMock 
     3from unittest.mock import MagicMock 
    44 
    55from PyQt4 import QtGui 
  • src/sas/qtgui/Plotting/UnitTesting/ColorMapTest.py

    r464cd07 r7fb471d  
    44 
    55from PyQt4 import QtGui 
    6 from mock import MagicMock 
     6from unittest.mock import MagicMock 
    77import matplotlib as mpl 
    88 
  • src/sas/qtgui/Plotting/UnitTesting/LinearFitTest.py

    r464cd07 r7fb471d  
    44 
    55from PyQt4 import QtGui 
    6 from mock import MagicMock 
     6from unittest.mock import MagicMock 
    77 
    88# set up import paths 
     
    5959        return_values = self.widget.parent.emit.call_args[0][1] 
    6060        # Compare 
    61         self.assertItemsEqual(return_values[0], [1.0, 3.0]) 
     61        self.assertCountEqual(return_values[0], [1.0, 3.0]) 
    6262        self.assertAlmostEqual(return_values[1][0], 10.004054329, 6) 
    6363        self.assertAlmostEqual(return_values[1][1], 12.030439848, 6) 
     
    6868        return_values = self.widget.parent.emit.call_args[0][1] 
    6969        # Compare 
    70         self.assertItemsEqual(return_values[0], [1.0, 3.0]) 
     70        self.assertCountEqual(return_values[0], [1.0, 3.0]) 
    7171        self.assertAlmostEqual(return_values[1][0], 9.987732937, 6) 
    7272        self.assertAlmostEqual(return_values[1][1], 11.84365082, 6) 
     
    8181        x, y, dy = self.widget.origData() 
    8282 
    83         self.assertItemsEqual(x, orig_x) 
     83        self.assertCountEqual(x, orig_x) 
    8484        self.assertEqual(y[0], orig_y[0]) 
    8585        self.assertAlmostEqual(y[1], orig_y[1], 8) 
     
    9898        x, y, dy = self.widget.origData() 
    9999 
    100         self.assertItemsEqual(x, orig_x) 
    101         self.assertItemsEqual(y, orig_y) 
    102         self.assertItemsEqual(dy, orig_dy) 
     100        self.assertCountEqual(x, orig_x) 
     101        self.assertCountEqual(y, orig_y) 
     102        self.assertCountEqual(dy, orig_dy) 
    103103 
    104104        # x, log(y) 
     
    111111        x, y, dy = self.widget.origData() 
    112112 
    113         self.assertItemsEqual(x, orig_x) 
     113        self.assertCountEqual(x, orig_x) 
    114114        self.assertEqual(y[0], orig_y[0]) 
    115115        self.assertAlmostEqual(y[1], orig_y[1], 8) 
  • src/sas/qtgui/Plotting/UnitTesting/PlotPropertiesTest.py

    r464cd07 r7fb471d  
    11import sys 
    22import unittest 
    3 from mock import MagicMock 
     3from unittest.mock import MagicMock 
    44 
    55from PyQt4 import QtGui 
  • src/sas/qtgui/Plotting/UnitTesting/Plotter2DTest.py

    rb2a5042 r7fb471d  
    77from PyQt4 import QtCore 
    88from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas 
    9 from mock import MagicMock 
     9from unittest.mock import MagicMock 
    1010from mpl_toolkits.mplot3d import Axes3D 
    1111 
  • src/sas/qtgui/Plotting/UnitTesting/PlotterBaseTest.py

    rb2a5042 r7fb471d  
    22import unittest 
    33import platform 
    4 from mock import patch, MagicMock 
     4from unittest.mock import MagicMock 
    55 
    66from PyQt4 import QtGui 
  • src/sas/qtgui/Plotting/UnitTesting/PlotterTest.py

    • Property mode changed from 100644 to 100755
    r749b715 r7fb471d  
    66from PyQt4 import QtCore 
    77from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas 
    8 from mock import MagicMock 
    9 from mock import patch 
     8from unittest.mock import MagicMock 
     9from unittest.mock import patch 
    1010 
    1111####### TEMP 
     
    257257 
    258258        # 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) 
    260260        self.plotter.onLinearFit(1) 
    261261 
     
    281281 
    282282        # 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) 
    284284 
    285285        # Delete one set 
    286286        self.plotter.onRemovePlot(2) 
    287287        # 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) 
    289289 
    290290        self.plotter.manager = MagicMock() 
     
    293293        self.plotter.onRemovePlot(1) 
    294294        # 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) 
    296296        # Assure the plotter window is closed 
    297297        self.assertFalse(self.plotter.isVisible()) 
  • src/sas/qtgui/Plotting/UnitTesting/SlicerModelTest.py

    r464cd07 r7fb471d  
    11import sys 
    22import unittest 
    3 from mock import MagicMock 
     3from unittest.mock import MagicMock 
    44 
    55from PyQt4 import QtGui 
  • src/sas/qtgui/Plotting/UnitTesting/SlicerParametersTest.py

    r464cd07 r7fb471d  
    11import sys 
    22import unittest 
    3 from mock import MagicMock 
     3from unittest.mock import MagicMock 
    44 
    55from PyQt4 import QtGui 
     
    77from PyQt4 import QtTest 
    88from PyQt4 import QtWebKit 
    9  
    10 from mock import MagicMock 
    119 
    1210# set up import paths 
Note: See TracChangeset for help on using the changeset viewer.