Changes in src/sas/qtgui/Utilities/UnitTesting/GuiUtilsTest.py [6cb305a:0261bc1] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Utilities/UnitTesting/GuiUtilsTest.py
r6cb305a r0261bc1 100 100 Test the QModelItem checkbox update method 101 101 """ 102 # test_item = QtGui.QStandardItem()103 # test_list = ['aa','11']104 # update_data = test_list105 # name = "Black Sabbath"106 107 # # update the item108 # updateModelItemWithPlot(test_item, update_data, name)109 110 102 test_item = QtGui.QStandardItem() 111 update_data = Data1D(x=[1.0, 2.0, 3.0], y=[10.0, 11.0, 12.0]) 103 test_list = ['aa','11'] 104 update_data = test_list 112 105 name = "Black Sabbath" 113 update_data.id = '[0]data0' 114 update_data.name = 'data0' 106 115 107 # update the item 116 108 updateModelItemWithPlot(test_item, update_data, name) 117 109 118 110 # Make sure test_item got all data added 119 111 self.assertEqual(test_item.child(0).text(), name) 120 112 self.assertTrue(test_item.child(0).isCheckable()) 121 data_from_item = test_item.child(0).child(0).data() 122 self.assertIsInstance(data_from_item, Data1D) 123 self.assertSequenceEqual(list(data_from_item.x), [1.0, 2.0, 3.0]) 124 self.assertSequenceEqual(list(data_from_item.y), [10.0, 11.0, 12.0]) 125 self.assertEqual(test_item.rowCount(), 1) 126 127 # add another dataset (different from the first one) 128 update_data1 = Data1D(x=[1.1, 2.1, 3.1], y=[10.1, 11.1, 12.1]) 129 update_data1.id = '[0]data1' 130 update_data1.name = 'data1' 131 name1 = "Black Sabbath1" 132 # update the item and check number of rows 133 updateModelItemWithPlot(test_item, update_data1, name1) 134 135 self.assertEqual(test_item.rowCount(), 2) 136 137 # add another dataset (with the same name as the first one) 138 # check that number of rows was not changed but data have been updated 139 update_data2 = Data1D(x=[4.0, 5.0, 6.0], y=[13.0, 14.0, 15.0]) 140 update_data2.id = '[1]data0' 141 update_data2.name = 'data0' 142 name2 = "Black Sabbath2" 143 updateModelItemWithPlot(test_item, update_data2, name2) 144 self.assertEqual(test_item.rowCount(), 2) 145 146 data_from_item = test_item.child(0).child(0).data() 147 self.assertSequenceEqual(list(data_from_item.x), [4.0, 5.0, 6.0]) 148 self.assertSequenceEqual(list(data_from_item.y), [13.0, 14.0, 15.0]) 113 list_from_item = test_item.child(0).child(0).data() 114 self.assertIsInstance(list_from_item, list) 115 self.assertEqual(str(list_from_item[0]), test_list[0]) 116 self.assertEqual(str(list_from_item[1]), test_list[1]) 149 117 150 118 … … 194 162 # Make sure only the checked data is present 195 163 # FRIDAY IN 196 self.assertIn(test_list0, plot_list[ 1])164 self.assertIn(test_list0, plot_list[0]) 197 165 # SATURDAY IN 198 self.assertIn(test_list1, plot_list[ 0])166 self.assertIn(test_list1, plot_list[1]) 199 167 # MONDAY NOT IN 200 168 self.assertNotIn(test_list2, plot_list[0])
Note: See TracChangeset
for help on using the changeset viewer.