Spaces:
Sleeping
Sleeping
| """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: <tag> | |
| FEELING: <word> | |
| INTENSITY_GUESS: <1-10|n/a> | |
| REMEDY: <one concrete action> | |
| NEXT_BRICK: <A|B|C|D|E|S|specific> | |
| DO_NOT: <one thing> | |
| LINE: <≤12 words> | |
| NOTE: <optional ≤20 words> | |
| DATA_THIN: <true|false>""" | |
| parsed = parse_template(raw) | |
| assert parsed is not None | |
| assert is_template_echo(raw, parsed) | |
| assert is_template_echo("LOOP: <tag>\nREMEDY: walk", None) | |
| def test_loop_angle_detect() -> None: | |
| assert is_template_echo("LOOP: <something>\nFEELING: ok") | |