gradio_labanmovementanalysis / test_component.py
BladeSzaSza's picture
Upload folder using huggingface_hub
e49993e verified
"""
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.")