Spaces:
Sleeping
Sleeping
File size: 2,237 Bytes
519c06d |
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
"""
Test PDF processor functionality
"""
import sys
from pathlib import Path
# Add src to path for imports
sys.path.insert(0, str(Path(__file__).parent.parent.parent))
"""
Test PDF processor functionality
"""
import sys
from pathlib import Path
# Add src to path for imports
sys.path.insert(0, str(Path(__file__).parent.parent.parent))
def test_pdf_processor_import():
"""Test that PDF processor can be imported"""
try:
# Import the module directly without going through __init__.py
import importlib.util
spec = importlib.util.spec_from_file_location(
"pdf_processor",
str(Path(__file__).parent.parent / "components" / "pdf_processor.py")
)
pdf_processor_module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(pdf_processor_module)
PDFProcessor = pdf_processor_module.PDFProcessor
print("PASS: PDF processor import test passed")
return True
except Exception as e:
print(f"FAIL: PDF processor import failed: {e}")
return False
def test_pdf_processor_creation():
"""Test that PDF processor can be created"""
try:
# Import the module directly without going through __init__.py
import importlib.util
spec = importlib.util.spec_from_file_location(
"pdf_processor",
str(Path(__file__).parent.parent / "components" / "pdf_processor.py")
)
pdf_processor_module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(pdf_processor_module)
PDFProcessor = pdf_processor_module.PDFProcessor
processor = PDFProcessor()
assert processor is not None
print("PASS: PDF processor creation test passed")
return True
except Exception as e:
print(f"FAIL: PDF processor creation failed: {e}")
return False
if __name__ == "__main__":
success = True
success &= test_pdf_processor_import()
success &= test_pdf_processor_creation()
if success:
print("All PDF processor tests passed!")
else:
print("Some tests failed!")
sys.exit(1)
|