#!/usr/bin/env python3 """ Simple validation script to test our implementation structure. """ def test_config(): """Test configuration loading.""" try: from src.utils.config import Config config = Config() indices = config.get_indices() print(f"✓ Config loaded successfully with {len(indices['indices'])} indices") return True except Exception as e: print(f"✗ Config test failed: {e}") return False def test_models(): """Test model definitions.""" try: from src.data.models import MarketData, Base print("✓ Models imported successfully") print(f"✓ MarketData table: {MarketData.__tablename__}") return True except Exception as e: print(f"✗ Models test failed: {e}") return False def test_file_structure(): """Test file structure.""" import os required_files = [ 'src/data/__init__.py', 'src/data/models.py', 'src/data/database.py', 'src/data/fetcher.py', 'src/data/storage.py', 'src/utils/__init__.py', 'src/utils/config.py', 'config/indices.json', 'requirements.txt' ] missing_files = [] for file_path in required_files: if not os.path.exists(file_path): missing_files.append(file_path) if missing_files: print(f"✗ Missing files: {missing_files}") return False else: print("✓ All required files present") return True def test_syntax(): """Test Python syntax.""" import py_compile import glob python_files = glob.glob('src/**/*.py', recursive=True) for file_path in python_files: try: py_compile.compile(file_path, doraise=True) except py_compile.PyCompileError as e: print(f"✗ Syntax error in {file_path}: {e}") return False print(f"✓ Syntax check passed for {len(python_files)} Python files") return True def main(): """Run all validation tests.""" print("Running MarketWise validation tests...") print("=" * 50) tests = [ ("File Structure", test_file_structure), ("Python Syntax", test_syntax), ("Configuration", test_config), ("Models", test_models), ] passed = 0 total = len(tests) for test_name, test_func in tests: print(f"\n{test_name}:") if test_func(): passed += 1 print("\n" + "=" * 50) print(f"Validation Results: {passed}/{total} tests passed") if passed == total: print("🎉 All validation tests passed!") return True else: print("❌ Some validation tests failed") return False if __name__ == "__main__": main()