Reports refactoring & tests

This commit is contained in:
Soxoj
2021-01-06 10:53:23 +03:00
parent 30f795065e
commit 5c8b65d033
5 changed files with 29 additions and 123 deletions
+13 -8
View File
@@ -2,12 +2,17 @@ import re
class CaseConverter:
@staticmethod
def camel_to_snake(camelcased_string: str):
return re.sub(r'(?<!^)(?=[A-Z])', '_', camelcased_string).lower()
@staticmethod
def camel_to_snake(camelcased_string: str):
return re.sub(r'(?<!^)(?=[A-Z])', '_', camelcased_string).lower()
@staticmethod
def snake_to_camel(snakecased_string: str):
formatted = ''.join(word.title() for word in snakecased_string.split('_'))
result = formatted[0].lower() + formatted[1:]
return result
@staticmethod
def snake_to_camel(snakecased_string: str):
formatted = ''.join(word.title() for word in snakecased_string.split('_'))
result = formatted[0].lower() + formatted[1:]
return result
def is_country_tag(tag):
"""detect if tag represent a country"""
return bool(re.match("^([a-z]){2}$", tag))