def test_model_sorts_rows_by_first_name_descending(sakila_connection): model = TableModel(sakila_connection, table) model.sort('first_name', 'desc') row = model[0] assert row[0] == 11 assert row[1] == 'ZERO'
def test_model_emits_error_signal(sakila_connection): model = TableModel(sakila_connection, table) assert model.last_error is None model.sort('non-existent-column', 'invalid-dir') assert isinstance(model.last_error, errors.ProgrammingError) assert len(model) == 0 assert len(model.data) == 0 assert model.loaded_rowcount == 0 assert bool(model.columns) is False