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.runtimeProduction registry schema-provider projection.
application.filing.testingPublic fixture helper facade that re-exports these builders.
- class RegistryTestProfile(tax_id, display_name)[source]¶
Bases:
objectMinimal
application.filing.ModeloProfilefor registry-backed tests.
- build_registry_filing_draft(*, modelo, period, profile_tax_id='Y0000001S', casilla_values, binding_values=None, status=ModeloDraftStatus.APROBADO)[source]¶
Build a
ModeloDraftthrough the validated registry runtime path.- Parameters:
modelo (
str) – Stable modelo id to resolve from the bundled registry.period (
object) – TypedPeriod; 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 toapplication.filing.build_draft().binding_values (
TypeAliasType|None) – Optional registry binding inputs. Keys that duplicatecasilla_valuesare rejected so fixture data cannot shadow itself.status (
ModeloDraftStatus) – Desired finalModeloDraftStatus.APROBADOusesapplication.filing.approve_draft(); every other status clears approval metadata on the built draft.
- Return type:
- Returns:
The built
ModeloDraft, approved only whenstatusisAPROBADO.- Raises:
ModeloBuilderError – When
periodis not aPeriod, 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 registryBindingIdtokens before the coerced values are forwarded tobuild_registry_filing_draft().- Parameters:
modelo (
str) – Stable modelo id to resolve from the bundled registry.profile_tax_id (
str) – Tax identifier written to the generated test profile.casilla_decimals (
Mapping[TypeVar(CasillaKey),str|Decimal]) – Casilla-id keyed values asDecimalinstances or decimal strings.binding_decimals (
Mapping[TypeVar(BindingKey),str|Decimal] |None) – Optional binding-id keyed values asDecimalinstances or decimal strings.status (
ModeloDraftStatus) – Desired finalModeloDraftStatus.
- Return type:
- Returns:
The
ModeloDraftreturned bybuild_registry_filing_draft().- Raises:
ValueError – When a casilla key is not a canonical casilla id.
ModeloBuilderError – When a binding key is not a canonical binding id.
decimal.InvalidOperation – When a decimal string cannot be parsed.