def _check_completions(model, expected):
 assert (model.rowCount() == len(expected))
 for i in range(0, model.rowCount()):
  actual_cat = model.item(i)
  catname = actual_cat.text()
  assert (catname in expected)
  expected_cat = expected[catname]
  assert (actual_cat.rowCount() == len(expected_cat))
  for j in range(0, actual_cat.rowCount()):
   name = actual_cat.child(j, 0)
   desc = actual_cat.child(j, 1)
   misc = actual_cat.child(j, 2)
   actual_item = (name.text(), desc.text(), misc.text())
   assert (actual_item in expected_cat)

def _check_completions ( model , expected ) : assert ( model . rowCount ( ) == len ( expected ) ) for i in range ( 0 , model . rowCount ( ) ) : actual_cat = model . item ( i ) catname = actual_cat . text ( ) assert ( catname in expected ) expected_cat = expected [ catname ] assert ( actual_cat . rowCount ( ) == len ( expected_cat ) ) for j in range ( 0 , actual_cat . rowCount ( ) ) : name = actual_cat . child ( j , 0 ) desc = actual_cat . child ( j , 1 ) misc = actual_cat . child ( j , 2 ) actual_item = ( name . text ( ) , desc . text ( ) , misc . text ( ) ) assert ( actual_item in expected_cat )
check that a model contains the expected items in any order .