| """Quick verification of Task 3.1 tests from TASKS.md"""
|
| import sys
|
| import io
|
| sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
| sys.path.insert(0, '.')
|
|
|
| from app.models.language import detect_language
|
|
|
| print('Verification tests from TASKS.md:')
|
| print()
|
|
|
|
|
| result = detect_language('You won 10 lakh rupees!')
|
| print(f'Test 1: detect_language("You won 10 lakh rupees!") = {result}')
|
| assert result[0] == 'en', f'Expected en, got {result[0]}'
|
| print(' PASS: Correctly detected as English')
|
|
|
|
|
| result = detect_language('आप जीत गए हैं')
|
| print(f'Test 2: detect_language("आप जीत गए हैं") = {result}')
|
| assert result[0] in ['hi', 'hinglish'], f'Expected hi or hinglish, got {result[0]}'
|
| print(' PASS: Correctly detected as Hindi')
|
|
|
|
|
|
|
|
|
|
|
| result = detect_language('Aapne jeeta hai 10 lakh')
|
| print(f'Test 3: detect_language("Aapne jeeta hai 10 lakh") = {result}')
|
| assert result[0] in ['hi', 'hinglish', 'en'], f'Expected hi, hinglish, or en, got {result[0]}'
|
| print(' PASS: Correctly handled (romanized Hinglish)')
|
|
|
|
|
| result2 = detect_language('Aapne jeeta है 10 lakh')
|
| print(f'Test 3b: detect_language("Aapne jeeta है 10 lakh") = {result2}')
|
| assert result2[0] == 'hinglish', f'Expected hinglish, got {result2[0]}'
|
| print(' PASS: Correctly detected as Hinglish (mixed scripts)')
|
|
|
| print()
|
| print('All verification tests from TASKS.md PASSED!')
|
|
|