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:
2
ddt.py
2
ddt.py
@@ -126,7 +126,7 @@ def mk_test_name(name, value, index=0):
|
|||||||
# fallback for python2
|
# fallback for python2
|
||||||
value = value.encode('ascii', 'backslashreplace')
|
value = value.encode('ascii', 'backslashreplace')
|
||||||
test_name = "{0}_{1}_{2}".format(name, index + 1, value)
|
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):
|
def feed_data(func, new_name, *args, **kwargs):
|
||||||
|
|||||||
Reference in New Issue
Block a user