def test_set_model(completionview):
 model = base.BaseCompletionModel()
 filtermodel = sortfilter.CompletionFilterModel(model)
 for i in range(3):
  model.appendRow(QStandardItem(str(i)))
 completionview.set_model(filtermodel)
 assert (completionview.model() is filtermodel)
 for i in range(model.rowCount()):
  assert completionview.isExpanded(filtermodel.index(i, 0))

def test_set_model ( completionview ) : model = base . BaseCompletionModel ( ) filtermodel = sortfilter . CompletionFilterModel ( model ) for i in range ( 3 ) : model . appendRow ( QStandardItem ( str ( i ) ) ) completionview . set_model ( filtermodel ) assert ( completionview . model ( ) is filtermodel ) for i in range ( model . rowCount ( ) ) : assert completionview . isExpanded ( filtermodel . index ( i , 0 ) )
ensure set_model actually sets the model and expands all categories .