示例#1
0
 def test_errors_in_cells_are_marked_by_ErrorCell(self):
     model = ArrayModel()
     index = model.index(0, 0)
     self.assertTrue(model.setData(index, "This won't work"))
     self.assertEqual(model.data(index, Qt.DisplayRole), "Error")
     self.assertEqual(
         model.data(index, Qt.ToolTipRole),
         "Cannot parse: Could not decode the value: Expecting value: line 1 column 1 (char 0)",
     )
     self.assertEqual(model.data(index, Qt.EditRole), "This won't work")
示例#2
0
 def test_data_for_first_row_returns_none_with_empty_array(self):
     model = ArrayModel()
     roles = [Qt.DisplayRole, Qt.ToolTip]
     index = model.index(0, 0)
     self.assertTrue(index.isValid())
     for role in roles:
         self.assertIsNone(model.data(index, role))
示例#3
0
 def test_data_in_edit_role_for_first_row_returns_default_float_with_empty_array(self):
     model = ArrayModel()
     index = model.index(0, 0)
     self.assertTrue(index.isValid())
     self.assertEqual(model.data(index, Qt.EditRole), 0.0)