def _set_time( model: QAbstractItemModel, current_index: Union[File, FileWriter], current_time: str, time_str: str, ): model.setData(model.index(current_index.row, 1), time_str) current_index.last_time = current_time
def _assert_model_rows_equal( model: QtCore.QAbstractItemModel, expected: List[Any], role: int = QtCore.Qt.DisplayRole, ): num_rows = model.rowCount() actual = [model.data(model.index(row, 0), role) for row in range(num_rows)] 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