aeat.domain.calculations.registry._scenarios module¶
Local registry calculation scenario verification harness.
Runs locally curated calculation scenarios against a
ValidatedRegistryAuthority snapshot and compares computed outputs to
declared expected values, reporting any mismatches with full trace context.
- class RegistryScenarioModel(**data)[source]¶
Bases:
BaseModelStrict frozen base for scenario verification records.
- class RegistryScenarioExpectedOutput(**data)[source]¶
Bases:
RegistryScenarioModelExpected value and trace contract for one scenario output.
- Parameters:
- target_casilla_id: CasillaId¶
- value: Decimal¶
- operand_refs: tuple[str, ...]¶
- operand_casilla_refs: tuple[CasillaId, ...]¶
- legal_refs: tuple[LegalRefId, ...]¶
- source_refs: tuple[SourceRefId, ...]¶
- class RegistryCalculationScenario(**data)[source]¶
Bases:
RegistryScenarioModelOne locally curated scenario for registry-only calculation verification.
- Parameters:
- id: str¶
- modelo: str¶
- revision: str¶
- filing_period: Period | None¶
- filing_year: int¶
- period: str¶
- inputs: dict[CasillaId, Decimal]¶
- binding_values: dict[BindingId, Decimal]¶
- enum_binding_values: dict[BindingId, str]¶
- relation_values: dict[RelationId, Decimal]¶
- date_context: dict[str, date]¶
- date_binding_values: dict[BindingId, date]¶
- expected_outputs: tuple[RegistryScenarioExpectedOutput, ...]¶
- notes: tuple[str, ...]¶
- class RegistryScenarioComparison(**data)[source]¶
Bases:
RegistryScenarioModelOne expected-vs-actual output comparison for a scenario run.
- Parameters:
target_casilla_id (CasillaId)
expected_value (Decimal)
actual_value (Decimal | None)
status (Literal['match', 'mismatch'])
expected_operand_casilla_refs (tuple[CasillaId, ...])
actual_operand_casilla_refs (tuple[CasillaId, ...])
expected_legal_refs (tuple[LegalRefId, ...])
actual_legal_refs (tuple[LegalRefId, ...])
expected_source_refs (tuple[SourceRefId, ...])
actual_source_refs (tuple[SourceRefId, ...])
detail (str | None)
- target_casilla_id: CasillaId¶
- expected_value: Decimal¶
- actual_value: Decimal | None¶
- status: ScenarioStatus¶
- expected_operand_refs: tuple[str, ...]¶
- actual_operand_refs: tuple[str, ...]¶
- expected_operand_casilla_refs: tuple[CasillaId, ...]¶
- actual_operand_casilla_refs: tuple[CasillaId, ...]¶
- expected_legal_refs: tuple[LegalRefId, ...]¶
- actual_legal_refs: tuple[LegalRefId, ...]¶
- expected_source_refs: tuple[SourceRefId, ...]¶
- actual_source_refs: tuple[SourceRefId, ...]¶
- detail: str | None¶
- class RegistryScenarioRunReport(**data)[source]¶
Bases:
RegistryScenarioModelResult of executing one local registry calculation scenario.
- Parameters:
scenario_id (str)
registry_snapshot_id (str)
status (Literal['match', 'mismatch'])
comparisons (tuple[RegistryScenarioComparison, ...])
calculation (RegistryCalculationResult)
- scenario_id: str¶
- registry_snapshot_id: str¶
- status: ScenarioStatus¶
- comparisons: tuple[RegistryScenarioComparison, ...]¶
- calculation: RegistryCalculationResult¶
- run_registry_calculation_scenario(scenario, *, registry_root, source_root)[source]¶
Execute
scenarioagainst the registry calculator and compare outputs.- Return type:
- Returns:
A
RegistryScenarioRunReportwith per-casilla comparison results.- Parameters:
scenario (RegistryCalculationScenario)
registry_root (Path)
source_root (Path)
- assert_registry_scenario_matches(report)[source]¶
Raise with comparison details unless the scenario matched exactly.
- Return type:
- Parameters:
report (RegistryScenarioRunReport)