Merge pull request #175 from AdrielVelazquez/master

Allow numbers in to_constant
This commit is contained in:
Syrus Akbary 2016-05-21 00:26:46 -07:00
commit ae8a23bfb8
2 changed files with 2 additions and 2 deletions

View File

@ -18,4 +18,4 @@ def to_snake_case(name):
def to_const(string): def to_const(string):
return re.sub('[\W|^(?=\d)]+', '_', string).upper() return re.sub('[\W|^]+', '_', string).upper()

View File

@ -19,4 +19,4 @@ def test_camel_case():
def test_to_const(): def test_to_const():
assert to_const('snakes $1. on a "#plane') == 'SNAKES_ON_A_PLANE' assert to_const('snakes $1. on a "#plane') == 'SNAKES_1_ON_A_PLANE'