# Path: phial/utils.py
# def parse_help_text(help_text: str) -> str:
#     """Parse help text."""
#     NEW_LINE_SEPERATOR = "<__NEW_LINE_SEPERATOR__>"
# 
#     # Strip excess whitespace
#     help_text = help_text.strip()
# 
#     # Remove single new lines
#     help_text = help_text.replace("\n", NEW_LINE_SEPERATOR)
#     help_text = help_text.replace(NEW_LINE_SEPERATOR * 2, "\n")
#     help_text = help_text.replace(NEW_LINE_SEPERATOR, "")
# 
#     # Remove extra spaces
#     help_text = re.sub(r"(^[ \t]+|[ \t]+)", " ", help_text, flags=re.M)
# 
#     return help_text


from phial.utils import parse_help_text
"""Test parse_help_text."""


def test_parse_help_text() -> None:
    """Check it doesn't mess up simple input."""
    help_text = "Help text"
    output = parse_help_text(help_text)
    assert output == help_text


def test_parse_help_text_single_new_line() -> None:
    """Check removes new line."""
    help_text = "Help text\n same line"
    output = parse_help_text(help_text)
    assert output == "Help text same line"


def test_parse_help_text_double_new_line() -> None:
    """Check converts double new line to single."""
    help_text = "Help text\n\n new line"
    output = parse_help_text(help_text)
    assert output == "Help text\n new line"


def test_parse_help_text_single_new_line_multline() -> None:
    """Check handles multine strings correctly."""
    help_text = """Help text
    same line"""

# Path: phial/utils.py
# def parse_help_text(help_text: str) -> str:
#     """Parse help text."""
#     NEW_LINE_SEPERATOR = "<__NEW_LINE_SEPERATOR__>"
# 
#     # Strip excess whitespace
#     help_text = help_text.strip()
# 
#     # Remove single new lines
#     help_text = help_text.replace("\n", NEW_LINE_SEPERATOR)
#     help_text = help_text.replace(NEW_LINE_SEPERATOR * 2, "\n")
#     help_text = help_text.replace(NEW_LINE_SEPERATOR, "")
# 
#     # Remove extra spaces
#     help_text = re.sub(r"(^[ \t]+|[ \t]+)", " ", help_text, flags=re.M)
# 
#     return help_text


# Path: tests/utils/test_parse_help_text.py
from phial.utils import parse_help_text

"""Test parse_help_text."""


def test_parse_help_text() -> None:
    """Check it doesn't mess up simple input."""
    help_text = "Help text"
    output = parse_help_text(help_text)
    assert output == help_text


def test_parse_help_text_single_new_line() -> None:
    """Check removes new line."""
    help_text = "Help text\n same line"
    output = parse_help_text(help_text)
    assert output == "Help text same line"


def test_parse_help_text_double_new_line() -> None:
    """Check converts double new line to single."""
    help_text = "Help text\n\n new line"
    output = parse_help_text(help_text)
    assert output == "Help text\n new line"


def test_parse_help_text_single_new_line_multline() -> None:
    """Check handles multine strings correctly."""
    help_text = """Help text
    same line"""

    output = parse_help_text(help_text)