#!/usr/bin/env python3 """ Test pypdf dependency for PDF processing functionality """ def test_pypdf_import(): """Test that pypdf can be imported successfully.""" try: import pypdf print("✅ pypdf import successful") print(f"✅ pypdf version: {pypdf.__version__}") return True except ImportError as e: print(f"❌ pypdf import failed: {e}") return False def test_pypdf_basic_functionality(): """Test basic pypdf functionality.""" try: from pypdf import PdfReader print("✅ PdfReader import successful") # Test that we can create a PdfReader instance (without actual file) print("✅ pypdf basic functionality available") return True except Exception as e: print(f"❌ pypdf functionality test failed: {e}") return False def main(): """Run pypdf dependency tests.""" print("🔍 Testing pypdf dependency...") tests = [ ("pypdf Import", test_pypdf_import), ("pypdf Functionality", test_pypdf_basic_functionality) ] passed = 0 total = len(tests) for test_name, test_func in tests: if test_func(): passed += 1 print(f"✅ {test_name}: PASSED") else: print(f"❌ {test_name}: FAILED") print(f"\n📊 pypdf Tests: {passed}/{total} passed") if passed == total: print("🎉 pypdf dependency ready for PDF processing!") return True else: print("⚠️ pypdf dependency issues detected") return False if __name__ == "__main__": success = main() exit(0 if success else 1)