# Path: esteid/util.py
# def get_id_from_legacy_common_name(common_name):
#     common_name = common_name.strip().rstrip(",")
# 
#     return common_name.split(",")[-1]
# 
# def get_name_from_legacy_common_name(common_name):
#     common_name = common_name.replace("\\,", ",")
#     common_name = common_name.strip().rstrip(",")
# 
#     parts = common_name.split(",")[:-1]
#     parts.reverse()
# 
#     return " ".join(parts).title()


import pytest
from esteid.util import get_id_from_legacy_common_name, get_name_from_legacy_common_name
# -*- coding: utf-8 -*-



@pytest.mark.parametrize(
    "common_name,expected_name",
    [
        ("TESTNUMBER,SEITSMES,51001091072", "Seitsmes Testnumber"),
        ("TESTNUMBER\\,SEITSMES\\,51001091072", "Seitsmes Testnumber"),
        ("TEST-NUMBER,SEITSMES MEES,51001091072", "Seitsmes Mees Test-Number"),
        ("O’CONNEŽ-ŠUSLIK,MARY ÄNN,11412090004", "Mary Änn O’Connež-Šuslik"),
    ],
)
def test_get_name_from_legacy_common_name(common_name, expected_name):

# Path: esteid/util.py
# def get_id_from_legacy_common_name(common_name):
#     common_name = common_name.strip().rstrip(",")
# 
#     return common_name.split(",")[-1]
# 
# def get_name_from_legacy_common_name(common_name):
#     common_name = common_name.replace("\\,", ",")
#     common_name = common_name.strip().rstrip(",")
# 
#     parts = common_name.split(",")[:-1]
#     parts.reverse()
# 
#     return " ".join(parts).title()


# Path: esteid/tests/test_common_name.py
import pytest
from esteid.util import get_id_from_legacy_common_name, get_name_from_legacy_common_name

# -*- coding: utf-8 -*-



@pytest.mark.parametrize(
    "common_name,expected_name",
    [
        ("TESTNUMBER,SEITSMES,51001091072", "Seitsmes Testnumber"),
        ("TESTNUMBER\\,SEITSMES\\,51001091072", "Seitsmes Testnumber"),
        ("TEST-NUMBER,SEITSMES MEES,51001091072", "Seitsmes Mees Test-Number"),
        ("O’CONNEŽ-ŠUSLIK,MARY ÄNN,11412090004", "Mary Änn O’Connež-Šuslik"),
    ],
)
def test_get_name_from_legacy_common_name(common_name, expected_name):

    result = get_name_from_legacy_common_name(common_name)