"""Coach parse: template echo must fall back to Rules backup.""" from app.coach_service import is_template_echo, parse_template def test_parse_ok() -> None: raw = """LOOP: shame FEELING: heavy INTENSITY_GUESS: 8 REMEDY: Leave the room for 10 min NEXT_BRICK: S DO_NOT: More labeling LINE: Outside first NOTE: DATA_THIN: false""" parsed = parse_template(raw) assert parsed is not None assert parsed["LOOP"] == "shame" assert not is_template_echo(raw, parsed) def test_template_echo_angle_brackets() -> None: raw = """LOOP: FEELING: INTENSITY_GUESS: <1-10|n/a> REMEDY: NEXT_BRICK: DO_NOT: LINE: <≤12 words> NOTE: DATA_THIN: """ parsed = parse_template(raw) assert parsed is not None assert is_template_echo(raw, parsed) assert is_template_echo("LOOP: \nREMEDY: walk", None) def test_loop_angle_detect() -> None: assert is_template_echo("LOOP: \nFEELING: ok")