Files
daily-journal-prompt/tests/test_feedback_integration.py
2026-01-03 02:30:33 -07:00

56 lines
1.8 KiB
Python

#!/usr/bin/env python3
"""
Test script to verify feedback_words integration
"""
import sys
import os
# Add the parent directory to the Python path
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from generate_prompts import JournalPromptGenerator
def test_feedback_words_loading():
"""Test that feedback_words are loaded correctly."""
print("Testing feedback_words integration...")
try:
# Initialize the generator
generator = JournalPromptGenerator()
# Check if feedback_words were loaded
print(f"Number of feedback words loaded: {len(generator.feedback_words)}")
if generator.feedback_words:
print("Feedback words loaded successfully:")
for i, feedback in enumerate(generator.feedback_words):
print(f" {i+1}. {feedback}")
else:
print("No feedback words loaded (this might be expected if file is empty)")
# Test _prepare_prompt_with_count method
print("\nTesting _prepare_prompt_with_count method...")
prompt_with_count = generator._prepare_prompt_with_count(3)
print(f"Prompt with count length: {len(prompt_with_count)} characters")
# Check if feedback words are included in the prompt with count
if generator.feedback_words and "Feedback words:" in prompt_with_count:
print("✓ Feedback words are included in the prompt with count")
else:
print("✗ Feedback words are NOT included in the prompt with count")
print("\n✅ All tests passed!")
return True
except Exception as e:
print(f"\n❌ Error during testing: {e}")
import traceback
traceback.print_exc()
return False
if __name__ == "__main__":
success = test_feedback_words_loading()
sys.exit(0 if success else 1)