@davoodmehraban89 / Aram-1 / commits / 79dcd34
Fork 0

test(control): use line-complete synthetic candidate fixtures for detail-level reconciliation

davoodmehraban89 committed Oct 31, 2026 at 11:23 UTC 79dcd340e0aa2ca93eba8fc3db7c525a4851cf8e
1 file changed +69 -12
backend/tests/test_cross_statement_reconciliation.py
+69 -12
@@ -16,8 +16,13 @@ from aram_backend.coverage_preview import CoverageError
16 from aram_backend.cross_statement_reconciliation import (
17 CashBalanceNoteSelection, reconcile_cross_statements,
18 )
19 -from aram_backend.equity_changes_candidate import EquityChangesCandidate
20 -from aram_backend.income_statement_candidate import IncomeStatementCandidate
19 +from aram_backend.equity_changes_candidate import (
20 + EquityAccountMovement, EquityChangesCandidate, EquityComponentTotal,
21 + EquityNoteMovement,
22 +)
23 +from aram_backend.income_statement_candidate import (
24 + CandidateIncomeStatementLine, IncomeStatementCandidate,
25 +)
26 from aram_backend.trial_balance_diagnostic import TrialBalanceAccount, TrialBalanceDiagnostic
27
28
@@ -67,11 +72,60 @@ def income(*, net="40", gross="60", eligible=True):
72 operating_profit="40", other_income_total="5",
73 other_expense_total="2", profit_before_tax="43",
74 tax_expense_total="3", net_result=net,
70 - lines=(), findings=(), eligible_for_analyst_review=eligible,
75 + lines=(
76 + CandidateIncomeStatementLine(
77 + "Revenue", "R01", "", "REVENUE", -1, "Revenue",
78 + "-100", "100", "REF-REV", "POL-REV",
79 + ),
80 + CandidateIncomeStatementLine(
81 + "Cost", "C01", "", "COST_OF_REVENUE", 1, "Cost of revenue",
82 + "40", "40", "REF-COST", "POL-COST",
83 + ),
84 + CandidateIncomeStatementLine(
85 + "Operating", "O01", "", "OPERATING_EXPENSE", 1, "Operating expense",
86 + "20", "20", "REF-OPEX", "POL-OPEX",
87 + ),
88 + CandidateIncomeStatementLine(
89 + "Other income", "I01", "", "OTHER_INCOME", -1, "Other income",
90 + "-5", "5", "REF-OIN", "POL-OIN",
91 + ),
92 + CandidateIncomeStatementLine(
93 + "Other expense", "X01", "", "OTHER_EXPENSE", 1, "Other expense",
94 + "2", "2", "REF-OEX", "POL-OEX",
95 + ),
96 + CandidateIncomeStatementLine(
97 + "Tax", "T01", "", "TAX_EXPENSE", 1, "Tax",
98 + "3", "3", "REF-TAX", "POL-TAX",
99 + ),
100 + ), findings=(), eligible_for_analyst_review=eligible,
101 )
102
103
104 def equity(*, closing="100", profit="40", eligible=True):
105 + closing_value = Decimal(closing)
106 + profit_value = Decimal(profit)
107 + rollforward = Decimal("60") + profit_value - closing_value
108 + account = EquityAccountMovement(
109 + account_code="EQ1", account_name="Equity", source_excel_row=2,
110 + source_row=1, statement_section="Equity", note_number="E01",
111 + subnote_code="", equity_component="RETAINED_EARNINGS",
112 + movement_category="NET_PROFIT_LOSS", sign_multiplier=-1,
113 + opening_balance="60", debit_turnover="0", credit_turnover=profit,
114 + movement_amount=profit, closing_balance=closing,
115 + policy_evidence_ref="POL-EQ",
116 + )
117 + note = EquityNoteMovement(
118 + statement_section="Equity", note_number="E01", subnote_code="",
119 + equity_component="RETAINED_EARNINGS", movement_category="NET_PROFIT_LOSS",
120 + line_label="Retained earnings", opening_balance="60",
121 + movement_amount=profit, closing_balance=closing,
122 + source_closing_exposure=str(-closing_value),
123 + note_reference_evidence="REF-EQ", policy_evidence_ref="POL-EQ",
124 + )
125 + component = EquityComponentTotal(
126 + equity_component="RETAINED_EARNINGS", opening_balance="60",
127 + movement_amount=profit, closing_balance=closing,
128 + )
129 return EquityChangesCandidate(
130 company_code="001", fiscal_year=1404, source_sha256=SOURCE,
131 note_references_sha256=REFS, presentation_policies_sha256=POLICY,
@@ -79,9 +133,9 @@ def equity(*, closing="100", profit="40", eligible=True):
133 net_profit_loss_movements=profit, dividends="0",
134 other_comprehensive_income="0", transfers="0",
135 prior_period_adjustments="0", other_movements="0",
82 - total_movement="40", closing_equity_total=closing,
83 - rollforward_difference="0", component_totals=(),
84 - note_movements=(), account_movements=(), findings=(),
136 + total_movement=profit, closing_equity_total=closing,
137 + rollforward_difference=str(rollforward), component_totals=(component,),
138 + note_movements=(note,), account_movements=(account,), findings=(),
139 eligible_for_analyst_review=eligible,
140 )
141
@@ -116,15 +170,18 @@ def cash(*, closing="50", net="10", eligible=True):
170
171
172 def trial(*, balanced=True):
173 + accounts = (
174 + TrialBalanceAccount("CASH1", "Cash", 2, 1, "40", "30", "20", "50", "10"),
175 + TrialBalanceAccount("REV", "Revenue", 3, 2, "0", "0", "30", "-30", "-30"),
176 + TrialBalanceAccount("EXP", "Expense", 4, 3, "0", "20", "0", "20", "20"),
177 + TrialBalanceAccount("OFFSET", "Offset", 5, 4, "-40", "0", "0", "-40", "0"),
178 + )
179 return TrialBalanceDiagnostic(
180 company_code="001", fiscal_year=1404, source_sha256=SOURCE,
121 - account_count=2, opening_debit_net_total="0",
122 - debit_turnover_total="100", credit_turnover_total="100",
181 + account_count=4, opening_debit_net_total="0",
182 + debit_turnover_total="50", credit_turnover_total="50",
183 closing_debit_net_total="0", movement_difference="0",
124 - opening_to_closing_difference="0", findings=(), accounts=(
125 - TrialBalanceAccount("CASH1", "Cash", 2, 1, "40", "30", "20", "50", "10"),
126 - TrialBalanceAccount("OFFSET", "Offset", 3, 2, "-40", "70", "80", "-50", "-10"),
127 - ),
184 + opening_to_closing_difference="0", findings=(), accounts=accounts,
185 balanced_for_analyst_review=balanced,
186 )
187