def test_flatten(self): x = (1, 2, 3, [1, 2], 'string', 0.1, {1: None}, [[1, 2, 3], {1: 1}, 1]) self.assertEqual(flt.iflatten(x), flt.flatten(x)) self.assertEqual(flt.flatten(x)[:5], [1, 2, 3, 1, 2]) self.assertEqual(list(flt.gflatten(x)), list(flt.flatten(x, generator=True))) self.assertIsInstance(flt.flatten(x, generator=True), types.GeneratorType)
def list_tests(suite: Union[List, unittest.TestSuite, unittest.TestCase]) -> Union[List[str], str]: """ Returns a full list of the tests run in the format 'TestClassName/test_method' :param suite: A TestCase or TestSuite instance, or list thereof :return: A list of tests """ if isinstance(suite, list): return flatten([list_tests(x) for x in suite]) elif not unittest.suite._isnotsuite(suite): return list_tests(suite._tests) elif isinstance(suite, (unittest.TestSuite, unittest.TestCase)): return f'{suite.__class__.__name__}/{suite._testMethodName}'