File size: 2,226 Bytes
486eff6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
#!/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() |