abc123 / hack /test_original_behavior.py
vimalk78's picture
feat(crossword): generated crosswords with clues
486eff6
raw
history blame
2.23 kB
#!/usr/bin/env python3
"""
Test that the fixed behavior matches the original version exactly
"""
from thematic_word_generator import UnifiedThematicWordGenerator
import logging
# Set up logging to see the detailed logs like original
logging.basicConfig(level=logging.INFO, format='%(message)s')
def test_exact_original_behavior():
print("πŸ§ͺ Testing Original Behavior Matching")
print("=" * 60)
# Use small vocabulary for quick testing
generator = UnifiedThematicWordGenerator(vocab_size_limit=1000)
generator.initialize()
print("\nπŸ“Š Test 1: Single sentence input (should NOT be split)")
print("Input: 'I will always love you'")
print("Expected: clean_inputs=['i will always love you'], multi_theme=False")
results = generator.generate_thematic_words("I will always love you", num_words=3)
print(f"βœ… Result: Found {len(results)} words")
print("\nπŸ“Š Test 2: Multiple sentence inputs (should trigger multi-theme)")
print("Input: ['I will always love you', 'moonpie', 'chocolate']")
print("Expected: clean_inputs=['i will always love you', 'moonpie', 'chocolate'], multi_theme=True (auto)")
results = generator.generate_thematic_words(
["I will always love you", "moonpie", "chocolate"],
num_words=5
)
print(f"βœ… Result: Found {len(results)} words")
print("\nπŸ“Š Test 3: Manual API call with multiple sentences")
print("Input: ['science is amazing', 'technology rocks', 'innovation drives progress']")
print("Expected: 3 inputs β†’ auto multi-theme=True")
results = generator.generate_thematic_words(
["science is amazing", "technology rocks", "innovation drives progress"],
num_words=5
)
print(f"βœ… Result: Found {len(results)} words")
print("\nπŸ“Š Test 4: Two inputs (should NOT trigger multi-theme)")
print("Input: ['cats', 'dogs']")
print("Expected: 2 inputs β†’ multi_theme=False")
results = generator.generate_thematic_words(["cats", "dogs"], num_words=3)
print(f"βœ… Result: Found {len(results)} words")
print("\nβœ… All behavior tests completed!")
if __name__ == "__main__":
test_exact_original_behavior()