from decimal import Decimal from pathlib import Path import pytest from app.parsers.registry import parse_pdf from app.parsers.validate import balance_difference FIXTURES = Path(__file__).parent / "fixtures" CASES = [("vr_beispiel.pdf", "vr"), ("hvb_beispiel.pdf", "hvb"), ("dkb_beispiel.pdf", "dkb")] @pytest.mark.parametrize("filename,bank", CASES) def test_parse_fixture(filename, bank): path = FIXTURES / filename if not path.exists(): pytest.skip(f"Fixture {filename} fehlt") stmt = parse_pdf(path) assert stmt.bank == bank assert stmt.opening_balance is not None assert stmt.closing_balance is not None assert len(stmt.transactions) > 0 assert balance_difference(stmt) == Decimal("0")