File size: 1,929 Bytes
b50aae8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
41
42
43
44
45
46
47
48
49
50
51
52
from rhythma_analysis import RhythmaSymphAICore


def test_build_session_profile_for_anxious_text():
    core = RhythmaSymphAICore(use_groq=False, use_embeddings=False)

    result = core.analyze_input("I feel anxious and need to settle down")

    assert result["emotional_state"] == "anxious"
    assert result["session_profile"]["title"] == "Grounding Tide"
    assert result["session_profile"]["pattern"] == "calm"
    assert result["session_profile"]["modulation_type"] == "sine"
    assert result["session_profile"]["guidance"].startswith("Let your breath")


def test_apply_profile_overrides_keeps_session_shape():
    core = RhythmaSymphAICore(use_groq=False, use_embeddings=False)

    result = core.analyze_input("I want to focus on deep work")
    profile = core.apply_profile_overrides(
        result["session_profile"],
        tone_center=512.0,
        modulation_type="pulse",
        session_pattern="focused",
    )

    assert profile["tone_center"] == 512.0
    assert profile["modulation_type"] == "pulse"
    assert profile["pattern"] == "focused"
    assert profile["title"] == result["session_profile"]["title"]


def test_build_session_profile_for_stressed_text():
    core = RhythmaSymphAICore(use_groq=False, use_embeddings=False)

    result = core.analyze_input("I feel stressed and overloaded")

    assert result["emotional_state"] == "stressed"
    assert result["session_profile"]["key"] == "stressed"
    assert result["session_profile"]["title"] == "Soft Landing"
    assert result["session_profile"]["pattern"] == "relaxed"


def test_explicit_emotion_wins_over_focus_heuristic():
    core = RhythmaSymphAICore(use_groq=False, use_embeddings=False)

    result = core.analyze_input("I feel anxious and need to focus")

    assert result["emotional_state"] == "anxious"
    assert result["session_profile"]["key"] == "anxious"
    assert result["session_profile"]["title"] == "Grounding Tide"