Spiritual_Health_Project / tests /unit /test_reasoning_display.py
DocUA's picture
feat: Complete prompt optimization system implementation
24214fc
#!/usr/bin/env python3
"""
Test reasoning display in conversation logging.
"""
import sys
import os
from dotenv import load_dotenv
# Load environment variables
load_dotenv()
# Add project root to path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from src.core.simplified_medical_app import SimplifiedMedicalApp
def test_reasoning_display():
"""Test reasoning display with indicators."""
print("🧪 Testing Reasoning Display")
print("=" * 50)
# Create app instance
app = SimplifiedMedicalApp()
# Test messages with different classifications
test_messages = [
"Привіт!", # Should be GREEN
"Я дуже хвилююся і не можу спати", # Should be YELLOW with reasoning
"Мені здається, що все безнадійно і немає сенсу жити" # Should be YELLOW/RED with reasoning
]
history = []
for i, message in enumerate(test_messages, 1):
print(f"\n--- Test {i}: '{message}' ---")
# Process message
new_history, status = app.process_message(message, history)
history = new_history
# Print the response with reasoning
if history:
last_response = history[-1]["content"]
print("Response with reasoning:")
print(last_response[:400] + "..." if len(last_response) > 400 else last_response)
print(f"Spiritual State: {app.spiritual_state.spiritual_state.value}")
if __name__ == "__main__":
test_reasoning_display()