PaperPod/tests/test_config.py
ilia a43ab20df6 Add crop refinement, finger removal, and local LLM naming
- vision/refine.py: tighten crops to the paper band (removes mat
  margins and hands beside receipts) and inpaint border-connected
  skin regions so fingers disappear from output
- llm/vision.py: identify documents with a local Ollama vision model
  (qwen2.5vl); extracts vendor/date/total/form code and flags quality
  issues (fingers, blur, glare); falls back to Tesseract when down
- pipeline: drop blank pages, dedupe consecutive captures of the same
  document, record refine/LLM fields in report and export summary
2026-07-08 18:23:50 -04:00

31 lines
912 B
Python

from paperpod.config import load_config
def test_defaults_without_file():
cfg = load_config(None)
assert cfg.capture.sample_fps == 8.0
assert cfg.motion.threshold == 0.02
assert cfg.motion.pixel_threshold == 12
assert cfg.document.detect_width == 1000
assert cfg.document.max_area_ratio == 0.92
assert cfg.document.max_aspect == 6.0
assert cfg.document.auto_rotate is True
def test_partial_override(tmp_path):
p = tmp_path / "config.yaml"
p.write_text("motion:\n threshold: 7.5\n")
cfg = load_config(p)
assert cfg.motion.threshold == 7.5
# untouched keys keep defaults
assert cfg.motion.stable_min_duration_s == 1.0
assert cfg.capture.sample_fps == 8.0
def test_repo_config_loads():
from pathlib import Path
repo_cfg = Path(__file__).parent.parent / "config.yaml"
cfg = load_config(repo_cfg)
assert cfg.output.dir == "./output"