mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-26 19:43:56 +03:00
Merge pull request #175 from AdrielVelazquez/master
Allow numbers in to_constant
This commit is contained in:
commit
ae8a23bfb8
|
@ -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()
|
||||||
|
|
|
@ -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'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user