from __future__ import annotations from app.analysis.sentence_split import normalize_trace_text, split_sentences def test_sentence_split_preserves_spacing_and_newlines() -> None: raw = "First sentence. Second sentence?\n\nThird sentence!" normalized = normalize_trace_text(raw) spans = split_sentences(normalized) assert normalized == "First sentence. Second sentence?\n\nThird sentence!" assert [span.text for span in spans] == [ "First sentence. ", "Second sentence?\n\n", "Third sentence!", ] assert spans[1].start_char == len("First sentence. ")