aeat.domain.calculations.registry._parity_tapes module¶
Scenario tape parity harness for manual AEAT workbook checks.
Loads, runs, and saves parity scenarios using a ValidatedRegistryAuthority
to obtain snapshots and evaluate formulas against official AEAT workbooks.
- class ParityScenario(**data)[source]¶
Bases:
ParityTapeModelOne manually curated workbook parity scenario.
- Parameters:
- id: str¶
- modelo: str¶
- revision: str¶
- filing_period: Period | None¶
- filing_year: int¶
- period: str¶
- workbook_path: Path¶
- synthetic_input: SyntheticInputSet¶
- output_cells: dict[WorkbookOutputId, WorkbookCellRef]¶
- registry_outputs: dict[WorkbookOutputId, CasillaId]¶
- date_context: dict[str, date]¶
- relation_values: dict[RelationId, Decimal]¶
- tolerance: Decimal¶
- notes: tuple[str, ...]¶
- class ParityTape(**data)[source]¶
Bases:
ParityTapeModelStored trace for one workbook parity execution.
- Parameters:
created_at (datetime)
scenario_path (str | None)
scenario (ParityScenario)
workbook (WorkbookArtefactReport)
runner (WorkbookRunnerAvailability)
report (WorkbookParityRunReport)
path (str | None)
- created_at: datetime¶
- scenario_path: str | None¶
- scenario: ParityScenario¶
- workbook: WorkbookArtefactReport¶
- runner: WorkbookRunnerAvailability¶
- report: WorkbookParityRunReport¶
- path: str | None¶
- class ParityTapeReplayReport(**data)[source]¶
Bases:
ParityTapeModelReplay comparison between an archived tape and the current runtime.
- Parameters:
tape_path (str)
scenario_id (str)
status (Literal['match', 'mismatch'])
stored (ParityTape)
current (ParityTape)
- tape_path: str¶
- scenario_id: str¶
- status: ParityStatus¶
- differences: tuple[str, ...]¶
- stored: ParityTape¶
- current: ParityTape¶
- load_parity_scenario(path)[source]¶
Load one parity scenario from JSON.
- Return type:
- Returns:
The validated
ParityScenariofrom the file.- Parameters:
path (Path)
- save_parity_scenario(scenario, path)[source]¶
Persist one parity scenario to JSON.
- Return type:
Path- Parameters:
scenario (ParityScenario)
path (Path)
- load_parity_tape(path)[source]¶
Load one
ParityTapefrom JSON.- Return type:
- Parameters:
path (Path)
- save_parity_tape(tape, path)[source]¶
Persist one parity tape to JSON.
- Return type:
Path- Parameters:
tape (ParityTape)
path (Path)
- generate_parity_tape_path(root, scenario_id, created_at)[source]¶
Return a deterministic archive path for one parity tape.
- run_parity_scenario(scenario, *, registry_root, source_root, scenario_path=None, executable=None)[source]¶
Execute one scenario against the registry and return a
ParityTape.- Return type:
- Parameters:
scenario (ParityScenario)
registry_root (Path)
source_root (Path)
scenario_path (Path | None)
executable (str | None)
- replay_parity_tape(tape, *, registry_root, source_root, tape_path=None, scenario_path=None, executable=None)[source]¶
Replay an archived tape against the current registry implementation.
- Return type:
- Returns:
A
ParityTapeReplayReportcomparing the archived tape to the current output.- Parameters: