Use raw string for regex

This issues a DeprecationWarning on python 3.6
due to \W not being a valid escape character in
regular strings.
This commit is contained in:
Eric Harney 2017-07-11 17:32:59 -04:00
parent 19e9b28724
commit 173190741f
1 changed files with 1 additions and 1 deletions

2
ddt.py
View File

@ -126,7 +126,7 @@ def mk_test_name(name, value, index=0):
# fallback for python2
value = value.encode('ascii', 'backslashreplace')
test_name = "{0}_{1}_{2}".format(name, index + 1, value)
return re.sub('\W|^(?=\d)', '_', test_name)
return re.sub(r'\W|^(?=\d)', '_', test_name)
def feed_data(func, new_name, *args, **kwargs):