# Path: openprovider/util.py
# def camel_to_snake(string):
#     """
#     Converts a camelCaseString to a snake_case_string.
# 
#     >>> camel_to_snake("fooBarBaz")
#     'foo_bar_baz'
#     """
#     return re.sub('([A-Z]+)', r'_\1', string).lower()
# 
# def snake_to_camel(value):
#     """
#     Converts a snake_case_string to a camelCaseString.
# 
#     >>> snake_to_camel("foo_bar_baz")
#     'fooBarBaz'
#     """
#     camel = "".join(word.title() for word in value.split("_"))
#     return value[:1].lower() + camel[1:]
# 
# def parse_phone_number(number):
#     if isinstance(number, basestring):
#         match = PHONE_REGEX.search(number)
#         if not match:
#             raise ValueError("Invalid phone number")
#         return match.groups()
#     elif isinstance(number, (tuple, list)):
#         if len(number) != 3:
#             raise ValueError("Invalid phone number")
#         return number
#     else:
#         raise ValueError("Invalid phone number")


import pytest
from openprovider.util import camel_to_snake, snake_to_camel, parse_phone_number
def test_snake_camel_snake():
    assert camel_to_snake(snake_to_camel("country_code")) == "country_code"


@pytest.mark.parametrize("value,expected", [
    ("", ""),
    ("name", "name"),
    ("company_name", "companyName"),
    ("spam_and_eggs", "spamAndEggs"),
    ("countryCode", "countrycode"),  # This may not be what the user wants, but it is what it is
])
def test_snake_to_camel(value, expected):
    assert snake_to_camel(value) == expected


def test_camel_snake_camel():
    assert snake_to_camel(camel_to_snake("countryCode")), "countryCode"


@pytest.mark.parametrize("number,expected", [
    ("+1.5552368", ("+1", "5", "552368")),
    (("+1", "867", "5309"), ("+1", "867", "5309")),
])
def test_parse_phone_number_valid_numbers(number, expected):
    assert parse_phone_number(number) == expected


@pytest.mark.parametrize("number", ["123", "+31.", [1, 2, 3, 4], object()])
def test_parse_phone_number_invalid_numbers(number):
    with pytest.raises(ValueError):

# Path: openprovider/util.py
# def camel_to_snake(string):
#     """
#     Converts a camelCaseString to a snake_case_string.
# 
#     >>> camel_to_snake("fooBarBaz")
#     'foo_bar_baz'
#     """
#     return re.sub('([A-Z]+)', r'_\1', string).lower()
# 
# def snake_to_camel(value):
#     """
#     Converts a snake_case_string to a camelCaseString.
# 
#     >>> snake_to_camel("foo_bar_baz")
#     'fooBarBaz'
#     """
#     camel = "".join(word.title() for word in value.split("_"))
#     return value[:1].lower() + camel[1:]
# 
# def parse_phone_number(number):
#     if isinstance(number, basestring):
#         match = PHONE_REGEX.search(number)
#         if not match:
#             raise ValueError("Invalid phone number")
#         return match.groups()
#     elif isinstance(number, (tuple, list)):
#         if len(number) != 3:
#             raise ValueError("Invalid phone number")
#         return number
#     else:
#         raise ValueError("Invalid phone number")


# Path: tests/test_util.py
import pytest
from openprovider.util import camel_to_snake, snake_to_camel, parse_phone_number

def test_snake_camel_snake():
    assert camel_to_snake(snake_to_camel("country_code")) == "country_code"


@pytest.mark.parametrize("value,expected", [
    ("", ""),
    ("name", "name"),
    ("company_name", "companyName"),
    ("spam_and_eggs", "spamAndEggs"),
    ("countryCode", "countrycode"),  # This may not be what the user wants, but it is what it is
])
def test_snake_to_camel(value, expected):
    assert snake_to_camel(value) == expected


def test_camel_snake_camel():
    assert snake_to_camel(camel_to_snake("countryCode")), "countryCode"


@pytest.mark.parametrize("number,expected", [
    ("+1.5552368", ("+1", "5", "552368")),
    (("+1", "867", "5309"), ("+1", "867", "5309")),
])
def test_parse_phone_number_valid_numbers(number, expected):
    assert parse_phone_number(number) == expected


@pytest.mark.parametrize("number", ["123", "+31.", [1, 2, 3, 4], object()])
def test_parse_phone_number_invalid_numbers(number):
    with pytest.raises(ValueError):

        parse_phone_number(number)