Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions graphene/utils/str_converters.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import re
from unidecode import unidecode


# Adapted from this response in Stackoverflow
Expand All @@ -16,7 +15,3 @@ def to_camel_case(snake_str):
def to_snake_case(name):
s1 = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", name)
return re.sub("([a-z0-9])([A-Z])", r"\1_\2", s1).lower()


def to_const(string):
return re.sub(r"[\W|^]+", "_", unidecode(string)).upper()
10 changes: 1 addition & 9 deletions graphene/utils/tests/test_str_converters.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# coding: utf-8
from ..str_converters import to_camel_case, to_const, to_snake_case
from ..str_converters import to_camel_case, to_snake_case


def test_snake_case():
Expand All @@ -17,11 +17,3 @@ def test_camel_case():
assert to_camel_case("snakes_on_a__plane") == "snakesOnA_Plane"
assert to_camel_case("i_phone_hysteria") == "iPhoneHysteria"
assert to_camel_case("field_i18n") == "fieldI18n"


def test_to_const():
assert to_const('snakes $1. on a "#plane') == "SNAKES_1_ON_A_PLANE"


def test_to_const_unicode():
assert to_const("Skoða þetta unicode stöff") == "SKODA_THETTA_UNICODE_STOFF"
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ def run_tests(self):
"graphql-core>=3.1.0b1,<4",
"graphql-relay>=3.0,<4",
"aniso8601>=8,<9",
"unidecode>=1.1.1,<2",
],
tests_require=tests_require,
extras_require={"test": tests_require, "dev": dev_requires},
Expand Down