Skip to content

Commit a1fc368

Browse files
authored
Remove to_const function (#1212)
1 parent 4b70186 commit a1fc368

File tree

3 files changed

+1
-15
lines changed

3 files changed

+1
-15
lines changed

graphene/utils/str_converters.py

-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import re
2-
from unidecode import unidecode
32

43

54
# Adapted from this response in Stackoverflow
@@ -16,7 +15,3 @@ def to_camel_case(snake_str):
1615
def to_snake_case(name):
1716
s1 = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", name)
1817
return re.sub("([a-z0-9])([A-Z])", r"\1_\2", s1).lower()
19-
20-
21-
def to_const(string):
22-
return re.sub(r"[\W|^]+", "_", unidecode(string)).upper()

graphene/utils/tests/test_str_converters.py

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# coding: utf-8
2-
from ..str_converters import to_camel_case, to_const, to_snake_case
2+
from ..str_converters import to_camel_case, to_snake_case
33

44

55
def test_snake_case():
@@ -17,11 +17,3 @@ def test_camel_case():
1717
assert to_camel_case("snakes_on_a__plane") == "snakesOnA_Plane"
1818
assert to_camel_case("i_phone_hysteria") == "iPhoneHysteria"
1919
assert to_camel_case("field_i18n") == "fieldI18n"
20-
21-
22-
def test_to_const():
23-
assert to_const('snakes $1. on a "#plane') == "SNAKES_1_ON_A_PLANE"
24-
25-
26-
def test_to_const_unicode():
27-
assert to_const("Skoða þetta unicode stöff") == "SKODA_THETTA_UNICODE_STOFF"

setup.py

-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ def run_tests(self):
8585
"graphql-core>=3.1.0b1,<4",
8686
"graphql-relay>=3.0,<4",
8787
"aniso8601>=8,<9",
88-
"unidecode>=1.1.1,<2",
8988
],
9089
tests_require=tests_require,
9190
extras_require={"test": tests_require, "dev": dev_requires},

0 commit comments

Comments
 (0)