So I understand your purpose is to generate a valid python identifier as a test name. This doesn't quite achieve it, it only caters for a very specific case.

What about something like this (source http://stackoverflow.com/a/3305731/166761):

```python
test_name = re.sub('\W|^(?=\d)','_', test_name)
```