"""Regression test generated by Power Migrate. Every cell that reconciled when the package was generated must still reconcile. Run with ``pytest`` from the directory that contains the package. """ import json from pathlib import Path from fpna_month_end import compute, load_inputs from fpna_month_end.xl import Book, values_match # Book.decode_value reads expected.json HERE = Path(__file__).parent def _load(name: str) -> dict: with open(HERE / name, encoding="utf-8") as fh: return json.load(fh) def test_reproduces_workbook_values() -> None: expected = _load("expected.json")["sheets"] baseline = _load("baseline.json") book = compute(load_inputs()) failures = [] for sheet, a1 in baseline["matched"]: want = Book.decode_value(expected[sheet][a1]) got = book[sheet][a1] if not values_match(want, got, baseline["rel_tol"], baseline["abs_tol"]): failures.append(f"{sheet}!{a1}: expected {want!r}, got {got.v!r}") assert not failures, "\n".join(failures[:50])