def compare_cols_row_book_data(book, row, data, special=None):
    if (special is None):
        special = {}
    for col in Book.COLUMNS:
        row_val = row[col]
        data_val = data[col]
        if (col in special):
            assert (row_val == special[col])
            assert (getattr(book, col) == special[col])
        elif (data_val is None):
            assert (row_val is None)
            assert (getattr(book, col) is None)
        else:
            assert (row_val == data_val)
            assert (getattr(book, col) == data_val)
    for col in Book.ASSOCIATED_COLUMNS:
        if (col == 'ext_infos'):
            continue
        col_assoc_concat = assoc_concat[col]
        row_val = row[col_assoc_concat]
        if (row_val is not None):
            row_val = (sorted(row_val.split(';')) if (';' in row_val) else [row_val])
        data_val = (sorted(data[col]) if data[col] else None)
        book_val = getattr(book, col)
        book_val = (sorted(book_val) if book_val else book_val)
        if (col in special):
            assert (row_val == special[col])
            assert (book_val == special[col])
        elif (data_val is None):
            assert (row_val is None)
            assert (book_val == [])
        else:
            assert (row_val == data_val)
            assert (book_val == data_val)
def compare_cols_row_book_data(book, row, data, special=None):
    if (special is None):
        special = {}
    for col in Book.COLUMNS:
        row_val = row[col]
        data_val = data[col]
        if (col in special):
            assert (row_val == special[col])
            assert (getattr(book, col) == special[col])
        elif (data_val is None):
            assert (row_val is None)
            assert (getattr(book, col) is None)
        else:
            assert (row_val == data_val)
            assert (getattr(book, col) == data_val)
    for col in Book.ASSOCIATED_COLUMNS:
        if (col == 'ext_infos'):
            continue
        col_assoc_concat = assoc_concat[col]
        row_val = row[col_assoc_concat]
        if (row_val is not None):
            row_val = (sorted(row_val.split(';')) if (';' in row_val) else [row_val])
        data_val = (sorted(data[col]) if data[col] else None)
        book_val = getattr(book, col)
        book_val = (sorted(book_val) if book_val else book_val)
        if (col in special):
            assert (row_val == special[col])
            assert (book_val == special[col])
        elif (data_val is None):
            assert (row_val is None)
            assert (book_val == [])
        else:
            assert (row_val == data_val)
            assert (book_val == data_val)