Spaces:
Sleeping
Sleeping
File size: 1,030 Bytes
4ccc966 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 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"
|