from __future__ import annotations

from dspy_file.file_analyzer import _clean_list, _ensure_list


def test_ensure_list_coerces_bullet_list_string() -> None:
    raw = """- First item
- Second item
- Third item"""

    result = _ensure_list(raw, "fallback", field_name="section_notes")

    assert result == ["First item", "Second item", "Third item"]


def test_clean_list_coerces_bullet_list_string() -> None:
    raw = """- Alpha
- Beta"""

    result = _clean_list(raw, field_name="references")

    assert result == ["Alpha", "Beta"]
