aeat.application.filing._testing_registry module

Registry-backed draft builders for filing tests.

The helpers keep tests on the same path as production filing: they resolve a typed Period through application.filing.build_runtime_schema_provider(), call application.filing.build_draft(), and only use application.filing.approve_draft() when the requested ModeloDraftStatus is APROBADO. The approval path receives an empty TransactionCatalogue and an empty InvoiceCatalogue so tests without ledger or invoice state get a deterministic approval basis without a bucket self-load.

See also

application.filing.runtime

Production registry schema-provider projection.

application.filing.testing

Public fixture helper facade that re-exports these builders.

class RegistryTestProfile(tax_id, display_name)[source]

Bases: object

Minimal application.filing.ModeloProfile for registry-backed tests.

Parameters:
  • tax_id (str)

  • display_name (str)

tax_id: str
display_name: str
build_registry_filing_draft(*, modelo, period, profile_tax_id='Y0000001S', casilla_values, binding_values=None, status=ModeloDraftStatus.APROBADO)[source]

Build a ModeloDraft through the validated registry runtime path.

Parameters:
  • modelo (str) – Stable modelo id to resolve from the bundled registry.

  • period (object) – Typed Period; raw string periods are rejected before registry lookup.

  • profile_tax_id (str) – Tax identifier written to the generated test profile.

  • casilla_values (TypeAliasType) – Casilla input mapping passed to application.filing.build_draft().

  • binding_values (TypeAliasType | None) – Optional registry binding inputs. Keys that duplicate casilla_values are rejected so fixture data cannot shadow itself.

  • status (ModeloDraftStatus) – Desired final ModeloDraftStatus. APROBADO uses application.filing.approve_draft(); every other status clears approval metadata on the built draft.

Return type:

ModeloDraft

Returns:

The built ModeloDraft, approved only when status is APROBADO.

Raises:

ModeloBuilderError – When period is not a Period, duplicate input ids are supplied, or the registry build/approval path rejects the fixture inputs.

build_registry_filing_draft_from_decimals(*, modelo, period, profile_tax_id='Y0000001S', casilla_decimals, binding_decimals=None, status=ModeloDraftStatus.APROBADO)[source]

Coerce decimal strings before building through the registry runtime.

Casilla keys are canonicalised with domain.calculations.registry.validated_casilla_id(); binding keys are validated as registry BindingId tokens before the coerced values are forwarded to build_registry_filing_draft().

Parameters:
  • modelo (str) – Stable modelo id to resolve from the bundled registry.

  • period (Period) – Typed Period passed through unchanged.

  • profile_tax_id (str) – Tax identifier written to the generated test profile.

  • casilla_decimals (Mapping[TypeVar(CasillaKey), str | Decimal]) – Casilla-id keyed values as Decimal instances or decimal strings.

  • binding_decimals (Mapping[TypeVar(BindingKey), str | Decimal] | None) – Optional binding-id keyed values as Decimal instances or decimal strings.

  • status (ModeloDraftStatus) – Desired final ModeloDraftStatus.

Return type:

ModeloDraft

Returns:

The ModeloDraft returned by build_registry_filing_draft().

Raises: