Spaces:
Sleeping
Sleeping
File size: 1,079 Bytes
fe617ac 6ad997d fe617ac | 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 |
import sys
from pathlib import Path
# Add project root to sys.path
PROJECT_ROOT = Path(__file__).resolve().parent.parent
sys.path.append(str(PROJECT_ROOT))
from src.data.stores.profile_store import get_favorites_with_metadata, _load_store, _migrate_favorites
def test_migration():
print("Testing profile migration...")
# Check raw store content
store = _load_store()
print(f"Raw store keys: {list(store.keys())}")
if "local" in store:
print(f"Local user favorites type: {type(store['local'].get('favorites'))}")
print(f"Local user favorites raw: {store['local'].get('favorites')}")
# Test get_favorites_with_metadata which triggers migration
try:
favs = get_favorites_with_metadata("local")
print(f"\nFetched favorites keys: {list(favs.keys())}")
print(f"First fav meta: {list(favs.values())[0] if favs else 'None'}")
except Exception as e:
print(f"Error fetching favorites: {e}")
import traceback
traceback.print_exc()
if __name__ == "__main__":
test_migration()
|