Spaces:
Sleeping
Sleeping
File size: 1,030 Bytes
57ed4c2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | """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")
|