# -*- coding: utf-8 -*-
"""
环境测试脚本
"""
import sys
import os

print("="*60)
print("Python Environment Test")
print("="*60)

print(f"\n1. Python Version:")
print(f"   {sys.version}")

print(f"\n2. Python Executable:")
print(f"   {sys.executable}")

print(f"\n3. Current Directory:")
print(f"   {os.getcwd()}")

print(f"\n4. Python Path:")
for p in sys.path[:5]:
    print(f"   {p}")

print(f"\n5. Testing imports:")

try:
    import json
    print("   ✅ json")
except ImportError as e:
    print(f"   ❌ json: {e}")

try:
    import pickle
    print("   ✅ pickle")
except ImportError as e:
    print(f"   ❌ pickle: {e}")

try:
    import time
    print("   ✅ time")
except ImportError as e:
    print(f"   ❌ time: {e}")

try:
    from sklearn.feature_extraction.text import TfidfVectorizer
    print("   ✅ sklearn (TfidfVectorizer)")
except ImportError as e:
    print(f"   ❌ sklearn: {e}")

try:
    from sklearn.naive_bayes import MultinomialNB
    print("   ✅ sklearn (MultinomialNB)")
except ImportError as e:
    print(f"   ❌ sklearn: {e}")

print(f"\n6. Checking test data:")
test_data_path = '../data/test_data_8000_full.json'
if os.path.exists(test_data_path):
    print(f"   ✅ Found: {test_data_path}")
    with open(test_data_path, 'r', encoding='utf-8') as f:
        import json
        data = json.load(f)
        print(f"   ✅ Samples: {len(data['samples'])}")
else:
    print(f"   ❌ Not found: {test_data_path}")

print("\n" + "="*60)
print("Test Complete!")
print("="*60)

input("\nPress Enter to exit...")
