Spaces:
Sleeping
Sleeping
| from __future__ import annotations | |
| import pytest | |
| from pydantic import ValidationError | |
| from enterprise_finance_env.models import ApplyForexAdjustment, EnterpriseFinanceActionPayload, QuerySubledger | |
| def test_query_subledger_rejects_inverted_date_range() -> None: | |
| with pytest.raises(ValidationError): | |
| QuerySubledger( | |
| entity="PARENT_US", | |
| account_code="IC_AR", | |
| date_range=("2026-03-02", "2026-03-01"), | |
| ) | |
| def test_apply_forex_adjustment_requires_positive_rate() -> None: | |
| with pytest.raises(ValidationError): | |
| ApplyForexAdjustment(txn_id="MED001", exchange_rate=0, date="2026-02-05") | |
| def test_action_union_parses_link_action() -> None: | |
| payload = EnterpriseFinanceActionPayload.model_validate( | |
| { | |
| "type": "link_transactions", | |
| "debit_txn_id": "TXN_DEBIT", | |
| "credit_txn_id": "TXN_CREDIT", | |
| "rationale": "Amounts and counterparties align.", | |
| } | |
| ) | |
| assert payload.root.type == "link_transactions" | |