"""Unit tests for utils.py.""" from github_client.utils import split_full_name_safely def test_split_standard_first_and_last() -> None: """Standard 'First Last' input returns correct components. :return: """ assert split_full_name_safely('John Doe') == ('John', 'Doe') def test_split_middle_name_is_ignored() -> None: """Middle name is discarded; first and last are returned. :return: """ assert split_full_name_safely('John Michael Doe') == ('John', 'Doe') def test_split_strips_title() -> None: """Titles such as 'Dr.' are stripped from the result. :return: """ assert split_full_name_safely('Dr. Jane Smith') == ('Jane', 'Smith') def test_split_strips_suffix() -> None: """Suffixes such as 'Jr.' are stripped from the result. :return: """ assert split_full_name_safely('John Doe Jr.') == ('John', 'Doe') def test_split_hyphenated_last_name() -> None: """Hyphenated last names are kept intact. :return: """ assert split_full_name_safely('Mary Jane-Smith') == ('Mary', 'Jane-Smith') def test_split_single_name_returns_empty_last() -> None: """A single-word name returns the word as first and empty string as last. :return: """ first, last = split_full_name_safely('Madonna') assert first == 'Madonna' assert last == '' def test_split_empty_string_returns_empty_components() -> None: """An empty string returns two empty strings without raising. :return: """ assert split_full_name_safely('') == ('', '')