tests cleanup
This commit is contained in:
66
tests/test_feedback_integration.py
Normal file
66
tests/test_feedback_integration.py
Normal file
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test script to verify feedback_words integration
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Add current directory to path
|
||||
sys.path.insert(0, 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 method
|
||||
print("\nTesting _prepare_prompt method...")
|
||||
prompt = generator._prepare_prompt()
|
||||
print(f"Prompt length: {len(prompt)} characters")
|
||||
|
||||
# Check if feedback words are included in the prompt
|
||||
if generator.feedback_words and "Feedback words:" in prompt:
|
||||
print("✓ Feedback words are included in the prompt")
|
||||
else:
|
||||
print("✗ Feedback words are NOT included in the prompt")
|
||||
|
||||
# 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)
|
||||
|
||||
Reference in New Issue
Block a user