def partition_suite_by_type(suite, classes, bins, reverse=False):
 suite_class = type(suite)
 if reverse:
  suite = reversed(tuple(suite))
 for test in suite:
  if isinstance(test, suite_class):
   partition_suite_by_type(test, classes, bins, reverse=reverse)
  else:
   for i in range(len(classes)):
    if isinstance(test, classes[i]):
     bins[i].add(test)
     break
   else:
    bins[(-1)].add(test)

def partition_suite_by_type ( suite , classes , bins , reverse = False ) : suite_class = type ( suite ) if reverse : suite = reversed ( tuple ( suite ) ) for test in suite : if isinstance ( test , suite_class ) : partition_suite_by_type ( test , classes , bins , reverse = reverse ) else : for i in range ( len ( classes ) ) : if isinstance ( test , classes [ i ] ) : bins [ i ] . add ( test ) break else : bins [ ( - 1 ) ] . add ( test )
partitions a test suite by test type .