File size: 2,300 Bytes
e49993e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""
Test script to verify the Laban Movement Analysis component structure.
"""

import sys
from pathlib import Path

# Add parent directory to path
sys.path.insert(0, str(Path(__file__).parent.parent / "backend"))

# Test imports
try:
    from gradio_labanmovementanalysis import LabanMovementAnalysis
    print("βœ“ LabanMovementAnalysis component imported successfully")
    
    from gradio_labanmovementanalysis import video_utils
    print("βœ“ video_utils module imported successfully")
    
    from gradio_labanmovementanalysis import pose_estimation
    print("βœ“ pose_estimation module imported successfully")
    
    from gradio_labanmovementanalysis import notation_engine
    print("βœ“ notation_engine module imported successfully")
    
    from gradio_labanmovementanalysis import json_generator
    print("βœ“ json_generator module imported successfully")
    
    from gradio_labanmovementanalysis import visualizer
    print("βœ“ visualizer module imported successfully")
    
except ImportError as e:
    print(f"βœ— Import error: {e}")
    sys.exit(1)

# Test component instantiation
try:
    component = LabanMovementAnalysis()
    print("\nβœ“ Component instantiated successfully")
    
    # Test component methods
    example_payload = component.example_payload()
    print(f"βœ“ Example payload: {example_payload}")
    
    example_value = component.example_value()
    print(f"βœ“ Example value keys: {list(example_value.keys())}")
    
    api_info = component.api_info()
    print(f"βœ“ API info type: {api_info['type']}")
    
except Exception as e:
    print(f"βœ— Component error: {e}")
    sys.exit(1)

# Test data structures
try:
    from gradio_labanmovementanalysis.pose_estimation import Keypoint, PoseResult
    kp = Keypoint(x=0.5, y=0.5, confidence=0.9, name="nose")
    print(f"\nβœ“ Keypoint created: {kp}")
    
    from gradio_labanmovementanalysis.notation_engine import Direction, Speed, Intensity
    print(f"βœ“ Direction values: {[d.value for d in Direction]}")
    print(f"βœ“ Speed values: {[s.value for s in Speed]}")
    print(f"βœ“ Intensity values: {[i.value for i in Intensity]}")
    
except Exception as e:
    print(f"βœ— Data structure error: {e}")
    sys.exit(1)

print("\nβœ… All tests passed! The component is properly structured.")