mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-22 01:26:49 +03:00
Remove to_const function (#1212)
This commit is contained in:
parent
4b70186031
commit
a1fc3688aa
|
@ -1,5 +1,4 @@
|
|||
import re
|
||||
from unidecode import unidecode
|
||||
|
||||
|
||||
# Adapted from this response in Stackoverflow
|
||||
|
@ -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()
|
||||
|
|
|
@ -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():
|
||||
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue
Block a user