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")
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))
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)