chore: import upstream snapshot with attribution
CI - Python Bindings / sdist (push) Failing after 1s
CI - Python Bindings / Build x86_64-unknown-linux-musl (push) Failing after 1s
CI / fmt (push) Failing after 1s
E2E Output Validation / compare-outputs (push) Failing after 1s
Sync Docs to Developer Hub / sync-docs (push) Failing after 1s
CI - Python Bindings / Build x86_64-unknown-linux-gnu (push) Failing after 1s
CI - WASM Bindings / Build WASM (push) Failing after 0s
CI / clippy (push) Failing after 1s
CI / build-and-test (ubuntu-latest) (push) Failing after 0s
CI - WASM Bindings / Edge runtime PDF parse test (push) Has been skipped
CI - WASM Bindings / Browser PDF parse test (push) Has been skipped
Deploy Demo to GitHub Pages / deploy (push) Failing after 1s
CI / build-docker-image (push) Failing after 3s
CI - Node Bindings / Build darwin-x64 (push) Has been cancelled
CI - Node Bindings / Test win32-x64-msvc (push) Has been cancelled
CI - Node Bindings / Build linux-arm64-gnu (push) Has been cancelled
CI - Node Bindings / Build linux-x64-gnu (push) Has been cancelled
CI - Node Bindings / Build linux-x64-musl (push) Has been cancelled
CI - Node Bindings / Build win32-arm64-msvc (push) Has been cancelled
CI - Node Bindings / Build win32-x64-msvc (push) Has been cancelled
CI - Node Bindings / Test darwin-arm64 (push) Has been cancelled
CI - Node Bindings / Test darwin-x64 (push) Has been cancelled
CI - Node Bindings / Test linux-x64-gnu (push) Has been cancelled
CI - Node Bindings / Test linux-x64-musl (push) Has been cancelled
CI - Node Bindings / Test win32-arm64-msvc (push) Has been cancelled
CI - Python Bindings / Build aarch64-pc-windows-msvc (push) Has been cancelled
CI - Python Bindings / Build x86_64-pc-windows-msvc (push) Has been cancelled
CI - Python Bindings / Build x86_64-apple-darwin (push) Has been cancelled
CI - Python Bindings / Build aarch64-apple-darwin (push) Has been cancelled
CI - Python Bindings / Build aarch64-unknown-linux-gnu (push) Has been cancelled
CI - Node Bindings / Build darwin-arm64 (push) Has been cancelled
CI - Python Bindings / Test x86_64-apple-darwin (push) Has been cancelled
CI - Python Bindings / Test aarch64-apple-darwin (push) Has been cancelled
CI - Python Bindings / Test x86_64-unknown-linux-gnu (push) Has been cancelled
CI - Python Bindings / Test x86_64-unknown-linux-musl (push) Has been cancelled
CI - Python Bindings / Test aarch64-pc-windows-msvc (push) Has been cancelled
CI - Python Bindings / Test x86_64-pc-windows-msvc (push) Has been cancelled
CI / build-and-test (macos-26-intel) (push) Has been cancelled
CI / build-and-test (macos-latest) (push) Has been cancelled
CI / build-and-test (windows-11-arm) (push) Has been cancelled
CI / build-and-test (windows-latest) (push) Has been cancelled
E2E Output Validation / upload-dataset (push) Has been cancelled
CI - Python Bindings / sdist (push) Failing after 1s
CI - Python Bindings / Build x86_64-unknown-linux-musl (push) Failing after 1s
CI / fmt (push) Failing after 1s
E2E Output Validation / compare-outputs (push) Failing after 1s
Sync Docs to Developer Hub / sync-docs (push) Failing after 1s
CI - Python Bindings / Build x86_64-unknown-linux-gnu (push) Failing after 1s
CI - WASM Bindings / Build WASM (push) Failing after 0s
CI / clippy (push) Failing after 1s
CI / build-and-test (ubuntu-latest) (push) Failing after 0s
CI - WASM Bindings / Edge runtime PDF parse test (push) Has been skipped
CI - WASM Bindings / Browser PDF parse test (push) Has been skipped
Deploy Demo to GitHub Pages / deploy (push) Failing after 1s
CI / build-docker-image (push) Failing after 3s
CI - Node Bindings / Build darwin-x64 (push) Has been cancelled
CI - Node Bindings / Test win32-x64-msvc (push) Has been cancelled
CI - Node Bindings / Build linux-arm64-gnu (push) Has been cancelled
CI - Node Bindings / Build linux-x64-gnu (push) Has been cancelled
CI - Node Bindings / Build linux-x64-musl (push) Has been cancelled
CI - Node Bindings / Build win32-arm64-msvc (push) Has been cancelled
CI - Node Bindings / Build win32-x64-msvc (push) Has been cancelled
CI - Node Bindings / Test darwin-arm64 (push) Has been cancelled
CI - Node Bindings / Test darwin-x64 (push) Has been cancelled
CI - Node Bindings / Test linux-x64-gnu (push) Has been cancelled
CI - Node Bindings / Test linux-x64-musl (push) Has been cancelled
CI - Node Bindings / Test win32-arm64-msvc (push) Has been cancelled
CI - Python Bindings / Build aarch64-pc-windows-msvc (push) Has been cancelled
CI - Python Bindings / Build x86_64-pc-windows-msvc (push) Has been cancelled
CI - Python Bindings / Build x86_64-apple-darwin (push) Has been cancelled
CI - Python Bindings / Build aarch64-apple-darwin (push) Has been cancelled
CI - Python Bindings / Build aarch64-unknown-linux-gnu (push) Has been cancelled
CI - Node Bindings / Build darwin-arm64 (push) Has been cancelled
CI - Python Bindings / Test x86_64-apple-darwin (push) Has been cancelled
CI - Python Bindings / Test aarch64-apple-darwin (push) Has been cancelled
CI - Python Bindings / Test x86_64-unknown-linux-gnu (push) Has been cancelled
CI - Python Bindings / Test x86_64-unknown-linux-musl (push) Has been cancelled
CI - Python Bindings / Test aarch64-pc-windows-msvc (push) Has been cancelled
CI - Python Bindings / Test x86_64-pc-windows-msvc (push) Has been cancelled
CI / build-and-test (macos-26-intel) (push) Has been cancelled
CI / build-and-test (macos-latest) (push) Has been cancelled
CI / build-and-test (windows-11-arm) (push) Has been cancelled
CI / build-and-test (windows-latest) (push) Has been cancelled
E2E Output Validation / upload-dataset (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
"""E2E tests for LiteParse.batch_parse() — validates Python types match CLI output."""
|
||||
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from liteparse import (
|
||||
BatchResult,
|
||||
LiteParse,
|
||||
OutputFormat,
|
||||
)
|
||||
|
||||
|
||||
class TestBatchParseBasic:
|
||||
"""Basic batch parsing functionality."""
|
||||
|
||||
def test_batch_parse_returns_batch_result(
|
||||
self, parser: LiteParse, invoice_pdf: Path
|
||||
):
|
||||
input_dir = invoice_pdf.parent
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
result = parser.batch_parse(
|
||||
input_dir,
|
||||
tmpdir,
|
||||
ocr_enabled=False,
|
||||
extension_filter=".pdf",
|
||||
)
|
||||
assert isinstance(result, BatchResult)
|
||||
assert result.output_dir == tmpdir
|
||||
|
||||
def test_batch_parse_creates_output_files(
|
||||
self, parser: LiteParse, invoice_pdf: Path
|
||||
):
|
||||
input_dir = invoice_pdf.parent
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
parser.batch_parse(
|
||||
input_dir,
|
||||
tmpdir,
|
||||
output_format=OutputFormat.TEXT,
|
||||
ocr_enabled=False,
|
||||
extension_filter=".pdf",
|
||||
)
|
||||
output_files = list(Path(tmpdir).rglob("*"))
|
||||
# Should have produced at least one output file
|
||||
assert len(output_files) > 0
|
||||
|
||||
def test_batch_parse_json_format(self, parser: LiteParse, invoice_pdf: Path):
|
||||
input_dir = invoice_pdf.parent
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
parser.batch_parse(
|
||||
input_dir,
|
||||
tmpdir,
|
||||
output_format="json",
|
||||
ocr_enabled=False,
|
||||
extension_filter=".pdf",
|
||||
)
|
||||
json_files = list(Path(tmpdir).rglob("*.json"))
|
||||
assert len(json_files) > 0
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_batch_parse_async(self, parser: LiteParse, invoice_pdf: Path):
|
||||
input_dir = invoice_pdf.parent
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
result = await parser.batch_parse_async(
|
||||
input_dir,
|
||||
tmpdir,
|
||||
output_format="json",
|
||||
ocr_enabled=False,
|
||||
extension_filter=".pdf",
|
||||
)
|
||||
assert isinstance(result, BatchResult)
|
||||
assert result.output_dir == tmpdir
|
||||
|
||||
|
||||
class TestBatchParseErrors:
|
||||
"""Test error handling."""
|
||||
|
||||
def test_input_dir_not_found(self, parser: LiteParse):
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
with pytest.raises(FileNotFoundError):
|
||||
parser.batch_parse("/nonexistent/dir", tmpdir)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_input_dir_not_found_async(self, parser: LiteParse):
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
with pytest.raises(FileNotFoundError):
|
||||
await parser.batch_parse_async("/nonexistent/dir", tmpdir)
|
||||
Reference in New Issue
Block a user