Skip to content

Commit ae8a23b

Browse files
committed
Merge pull request #175 from AdrielVelazquez/master
Allow numbers in to_constant
2 parents 2ea6ab4 + 4d15bc4 commit ae8a23b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

graphene/utils/str_converters.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ def to_snake_case(name):
1818

1919

2020
def to_const(string):
21-
return re.sub('[\W|^(?=\d)]+', '_', string).upper()
21+
return re.sub('[\W|^]+', '_', string).upper()

graphene/utils/tests/test_str_converter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ def test_camel_case():
1919

2020

2121
def test_to_const():
22-
assert to_const('snakes $1. on a "#plane') == 'SNAKES_ON_A_PLANE'
22+
assert to_const('snakes $1. on a "#plane') == 'SNAKES_1_ON_A_PLANE'

0 commit comments

Comments
 (0)