diff -r f0a6bf48b05e -r 8949af6a4279 testsuite.py --- a/testsuite.py Sat Jun 08 01:32:25 2019 +0300 +++ b/testsuite.py Sat Jun 08 01:42:48 2019 +0300 @@ -17,6 +17,17 @@ bad_object = bad_object, **args, ) + def placeholder_message(self): + if callable(self.message): + import inspect + spec = inspect.getfullargspec(self.message) + args = {} + assert not spec.varargs and not spec.varkw + for argname in spec.args + spec.kwonlyargs: + args[argname] = '<' + argname.replace('_', ' ') + '>' + return self.message(**args) + else: + return self.message class Problem: def __init__(self, problem_class, bad_object, **args): @@ -160,9 +171,16 @@ messages.append(message) return '\n'.join(messages) -def all_warning_types(test_suite): +def iterate_problems(test_suite): for test_function in test_suite['tests']: yield from test_function.ldcheck_problem_types.values() + +def all_problem_types(test_suite): + return sorted( + iterate_problems(test_suite), + key = lambda problem_type: problem_type.name + ) + if __name__ == '__main__': from pprint import pprint