def test_headerData(self): """Test the headerData() method of MinimalTableModel.""" model = MinimalTableModel() labels = ['a', 'b', 'c'] model.set_horizontal_header_labels(labels) for index, label in enumerate(labels): self.assertEqual(model.headerData(index), label) self.assertEqual(model.headerData(5, orientation=Qt.Vertical), 5 + 1)
def test_setHeaderData(self): """Test the setHeaderData() method of MinimalTableModel.""" model = MinimalTableModel() model.set_horizontal_header_labels(['a']) self.assertTrue(model.setHeaderData(0, Qt.Horizontal, 'b')) self.assertEqual(model.horizontal_header_labels(), ['b']) self.assertFalse(model.setHeaderData(0, Qt.Vertical, 'c')) self.assertFalse( model.setHeaderData(0, Qt.Horizontal, 'd', role=Qt.ToolTipRole)) self.assertIsNone(model.headerData(0, role=Qt.ToolTipRole))
def test_set_horizontal_header_labels(self): """Test the set_horizontal_header_labels() method of MinimalTableModel.""" model = MinimalTableModel() model.set_horizontal_header_labels(['a', 'b']) self.assertEqual(model.horizontal_header_labels(), ['a', 'b'])