def _flatten_suite(test):
 if isinstance(test, (unittest.TestSuite, list, tuple)):
  tests = []
  for x in test:
   tests.extend(_flatten_suite(x))
  return tests
 else:
  return [test]

def _flatten_suite ( test ) : if isinstance ( test , ( unittest . TestSuite , list , tuple ) ) : tests = [ ] for x in test : tests . extend ( _flatten_suite ( x ) ) return tests else : return [ test ]
expand nested suite into list of test cases .