def _assert_horizontal_header_equal( model: QtCore.QAbstractItemModel, expected: List[Any], role: int = QtCore.Qt.DisplayRole, ): num_cols = model.columnCount() actual = [ model.headerData(column, QtCore.Qt.Horizontal, role) for column in range(num_cols) ] assert actual == expected
def _assert_model_data_equal( model: QtCore.QAbstractItemModel, expected: List[List[Any]], role: int = QtCore.Qt.DisplayRole, ): num_rows = model.rowCount() num_cols = model.columnCount() actual = [[ model.data(model.index(row, column), role) for column in range(num_cols) ] for row in range(num_rows)] assert actual == expected