feat(normalizer): add main() CLI to persons_tree
Wires the two-pass pipeline (parse → deduplicate → index → resolve) into a runnable CLI with --input, --output, and --dry-run flags. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -431,3 +431,27 @@ def test_parse_bemerkung_sohn_with_trailing_remark():
|
||||
assert len(rels) == 2
|
||||
assert unres == []
|
||||
assert notes == "nach Mexiko emigriert"
|
||||
|
||||
|
||||
import subprocess
|
||||
|
||||
|
||||
def test_dry_run_exits_zero(tmp_path):
|
||||
"""dry-run should complete without writing any file and exit 0."""
|
||||
input_path = Path(__file__).parent.parent.parent.parent / "import" / "Personendatei 2.xlsx"
|
||||
if not input_path.exists():
|
||||
import pytest
|
||||
pytest.skip("source Excel file not present")
|
||||
|
||||
result = subprocess.run(
|
||||
[
|
||||
sys.executable, str(Path(__file__).parent.parent / "persons_tree.py"),
|
||||
"--input", str(input_path),
|
||||
"--output", str(tmp_path / "out.json"),
|
||||
"--dry-run",
|
||||
],
|
||||
capture_output=True, text=True,
|
||||
)
|
||||
assert result.returncode == 0, result.stderr
|
||||
assert not (tmp_path / "out.json").exists()
|
||||
assert "persons parsed" in result.stdout
|
||||
|
||||
Reference in New Issue
Block a user