from app.appearance import mood_to_appearance def ap(v, a, d=128, u=128, g=128, w=128, i=128): return mood_to_appearance([v, a, d, u, g, w, i]) def test_keys(): o = ap(128, 128) for k in ("hue", "saturation", "lightness", "aura", "scale", "droop", "lean", "face", "mood"): assert k in o for k in ("mouth", "eye", "brow"): assert k in o["face"] def test_body_always_yellow(): # mascot identity: the body hue is constant Hugging-Face yellow regardless of mood assert ap(20, 128)["hue"] == 48.0 == ap(230, 128)["hue"] == ap(128, 255)["hue"] def test_emotion_shows_via_glow_not_body(): assert ap(60, 200)["glow"]["type"] == "anger" # low V + high A → red anger glow assert ap(70, 60)["glow"]["type"] == "sad" # low V + low A → blue sad glow assert ap(210, 210)["glow"]["type"] == "joy" # high V + high A → joy blush assert ap(128, 128)["glow"]["intensity"] == 0.0 # neutral → no glow def test_face_tracks_valence_mouth(): assert ap(230, 128)["face"]["mouth"] > 0 # smile (curve up) assert ap(20, 128)["face"]["mouth"] < 0 # frown (curve down) def test_arousal_opens_eyes_and_saturates(): assert ap(128, 240)["face"]["eye"] > ap(128, 40)["face"]["eye"] assert ap(128, 240)["saturation"] > ap(128, 40)["saturation"]