File size: 4,617 Bytes
250bf8c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/usr/bin/env python3
"""
Simple test script to verify adaptive learning imports work correctly.
"""

import sys
from pathlib import Path

# Add the project root to the Python path
project_root = Path(__file__).parent
sys.path.insert(0, str(project_root))

def test_imports():
    """Test all adaptive learning imports."""
    print("πŸ§ͺ Testing Adaptive Learning System Imports")
    print("=" * 50)
    
    try:
        print("1. Testing analytics imports...")
        from mcp_server.analytics.performance_tracker import PerformanceTracker
        from mcp_server.analytics.learning_analytics import LearningAnalytics
        from mcp_server.analytics.progress_monitor import ProgressMonitor
        print("   βœ… Analytics imports successful")
        
        print("2. Testing algorithms imports...")
        from mcp_server.algorithms.adaptive_engine import AdaptiveLearningEngine
        from mcp_server.algorithms.difficulty_adjuster import DifficultyAdjuster
        from mcp_server.algorithms.path_optimizer import PathOptimizer
        from mcp_server.algorithms.mastery_detector import MasteryDetector
        print("   βœ… Algorithms imports successful")
        
        print("3. Testing models imports...")
        from mcp_server.models.student_profile import StudentProfile
        print("   βœ… Models imports successful")
        
        print("4. Testing storage imports...")
        from mcp_server.storage.memory_store import MemoryStore
        print("   βœ… Storage imports successful")
        
        print("5. Testing component initialization...")
        performance_tracker = PerformanceTracker()
        learning_analytics = LearningAnalytics(performance_tracker)
        progress_monitor = ProgressMonitor(performance_tracker, learning_analytics)
        adaptive_engine = AdaptiveLearningEngine(performance_tracker, learning_analytics)
        difficulty_adjuster = DifficultyAdjuster(performance_tracker)
        path_optimizer = PathOptimizer(performance_tracker, learning_analytics)
        mastery_detector = MasteryDetector(performance_tracker)
        print("   βœ… Component initialization successful")
        
        print("6. Testing adaptive learning tools import...")
        import mcp_server.tools.adaptive_learning_tools
        print("   βœ… Adaptive learning tools import successful")
        
        print("\nπŸŽ‰ All imports successful!")
        print("The adaptive learning system is ready to use.")
        
        return True
        
    except Exception as e:
        print(f"\n❌ Import failed: {e}")
        import traceback
        traceback.print_exc()
        return False

def test_basic_functionality():
    """Test basic functionality without async."""
    print("\nπŸ”§ Testing Basic Functionality")
    print("=" * 50)
    
    try:
        from mcp_server.analytics.performance_tracker import PerformanceTracker
        from mcp_server.models.student_profile import StudentProfile
        from mcp_server.storage.memory_store import MemoryStore
        
        # Test performance tracker
        print("1. Testing PerformanceTracker...")
        tracker = PerformanceTracker()
        print(f"   βœ… Created tracker with {len(tracker.student_performances)} students")
        
        # Test student profile
        print("2. Testing StudentProfile...")
        profile = StudentProfile(student_id="test_001", name="Test Student")
        print(f"   βœ… Created profile for {profile.name}")
        
        # Test memory store
        print("3. Testing MemoryStore...")
        store = MemoryStore()
        store.save_student_profile(profile)
        retrieved = store.get_student_profile("test_001")
        print(f"   βœ… Stored and retrieved profile: {retrieved.name if retrieved else 'None'}")
        
        print("\nπŸŽ‰ Basic functionality test successful!")
        return True
        
    except Exception as e:
        print(f"\n❌ Functionality test failed: {e}")
        import traceback
        traceback.print_exc()
        return False

if __name__ == "__main__":
    print("🧠 TutorX-MCP Adaptive Learning System - Import Test")
    print("=" * 60)
    
    # Test imports
    imports_ok = test_imports()
    
    if imports_ok:
        # Test basic functionality
        functionality_ok = test_basic_functionality()
        
        if functionality_ok:
            print("\nβœ… All tests passed! The system is ready.")
            sys.exit(0)
        else:
            print("\n❌ Functionality tests failed.")
            sys.exit(1)
    else:
        print("\n❌ Import tests failed.")
        sys.exit(1)