Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def generate_test_numbers(test_class):
- counter = 1
- for method_name in dir(test_class):
- if not method_name.startswith('test_N_'):
- continue
- method = getattr(test_class, method_name)
- if not callable(method):
- continue
- new_method_name = method_name.replace('_N_', '_{:02d}_'.format(counter))
- counter += 1
- setattr(test_class, new_method_name, method)
- delattr(test_class, method_name)
- return test_class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement