Test specific processor functionality.
()
| 84 | |
| 85 | |
| 86 | def test_processor_specific_functionality(): |
| 87 | """Test specific processor functionality.""" |
| 88 | print("\n" + "=" * 50) |
| 89 | print("🔧 Testing Processor-Specific Functionality") |
| 90 | print("=" * 50) |
| 91 | |
| 92 | extractor = DocumentExtractor() |
| 93 | |
| 94 | # Test CSV processing |
| 95 | print("\n1. Testing CSV processing...") |
| 96 | try: |
| 97 | with tempfile.NamedTemporaryFile(mode='w', suffix='.csv', delete=False) as f: |
| 98 | f.write("Name,Age,City\nJohn,30,New York\nJane,25,Los Angeles\nBob,35,Chicago") |
| 99 | temp_file = f.name |
| 100 | |
| 101 | result = extractor.extract(temp_file) |
| 102 | print(f"✅ CSV conversion successful: {len(result.content)} characters") |
| 103 | print(f" Rows: {result.metadata.get('row_count')}") |
| 104 | print(f" Columns: {result.metadata.get('column_count')}") |
| 105 | |
| 106 | os.unlink(temp_file) |
| 107 | |
| 108 | except Exception as e: |
| 109 | print(f"❌ CSV conversion failed: {e}") |
| 110 | |
| 111 | # Test HTML processing |
| 112 | print("\n2. Testing HTML processing...") |
| 113 | try: |
| 114 | html_content = """ |
| 115 | <html> |
| 116 | <head><title>Test Page</title></head> |
| 117 | <body> |
| 118 | <h1>Main Heading</h1> |
| 119 | <p>This is a paragraph.</p> |
| 120 | <h2>Sub Heading</h2> |
| 121 | <ul> |
| 122 | <li>Item 1</li> |
| 123 | <li>Item 2</li> |
| 124 | </ul> |
| 125 | <table> |
| 126 | <tr><th>Name</th><th>Value</th></tr> |
| 127 | <tr><td>Test</td><td>123</td></tr> |
| 128 | </table> |
| 129 | </body> |
| 130 | </html> |
| 131 | """ |
| 132 | |
| 133 | with tempfile.NamedTemporaryFile(mode='w', suffix='.html', delete=False) as f: |
| 134 | f.write(html_content) |
| 135 | temp_file = f.name |
| 136 | |
| 137 | result = extractor.extract(temp_file) |
| 138 | print(f"✅ HTML conversion successful: {len(result.content)} characters") |
| 139 | print(f" Contains table: {'table' in result.content.lower()}") |
| 140 | print(f" Contains list: {'item' in result.content.lower()}") |
| 141 | |
| 142 | os.unlink(temp_file) |
| 143 |
no test coverage detected