#!/usr/bin/env python3
"""
Test the data loader functions.
"""

import sys
import os
sys.path.append('/app/src')

# Add the src directory to Python path
sys.path.insert(0, '/app/src')

def test_data_loader():
    """Test the data loader functions."""
    print("🔍 Testing data loader functions...")
    
    try:
        # Import the data loader
        from utils.data_loader import data_loader
        
        print("1. Testing load_known_artists()...")
        artists = data_loader.load_known_artists()
        print(f"   Type: {type(artists)}")
        print(f"   Keys: {list(artists.keys())[:5]}...")
        
        # Test a specific key
        if 'AC/DC' in artists:
            print(f"   AC/DC MBID: {artists['AC/DC']}")
            print(f"   Type: {type(artists['AC/DC'])}")
        
        print("\n2. Testing load_name_variations()...")
        variations = data_loader.load_name_variations()
        print(f"   Type: {type(variations)}")
        print(f"   Keys: {list(variations.keys())}")
        
        print("\n3. Testing load_known_recordings()...")
        recordings = data_loader.load_known_recordings()
        print(f"   Type: {type(recordings)}")
        print(f"   Keys: {list(recordings.keys())[:3]}...")
        
        # Test a specific key
        if recordings:
            first_key = list(recordings.keys())[0]
            print(f"   First key: {first_key} (type: {type(first_key)})")
            print(f"   First value: {recordings[first_key]} (type: {type(recordings[first_key])})")
        
    except Exception as e:
        print(f"❌ Error: {e}")
        import traceback
        traceback.print_exc()

if __name__ == "__main__":
    test_data_loader() 