@davoodmehraban89 / Aram-2 Mirror · read-only / commits / 3d36acc
Fork 0

Mirrored from https://github.com/davoodmehraban89/Aram.git

Synced Dec 3, 23:15 UTC

test(mapping): verify reference review supports same account across BS and EQ

davoodmehraban89 committed Oct 31, 2026 at 08:48 UTC 3d36acc78bd9809c91ab1f18d67b966ac2337925
1 file changed +41 -1
backend/tests/test_reconciliation_review.py
+41 -1
@@ -5,7 +5,7 @@ from io import BytesIO
5 import json
6
7 import pytest
8 -from openpyxl import Workbook
8 +from openpyxl import Workbook, load_workbook
9
10 from aram_backend.coverage_preview import CoverageError
11 from aram_backend.pilot_workbook import SHEET_HEADERS
@@ -231,3 +231,43 @@ def test_all_zero_note_reference_does_not_crash_exact_decimal_difference():
231 assert reviewed.matched_for_analyst_review
232 assert reviewed.notes[0].difference == "0"
233 assert reviewed.candidate_closing_exposure == "0"
234 +
235 +
236 +def test_one_account_can_reconcile_to_multiple_distinct_statement_notes():
237 + source = workbook()
238 + book = load_workbook(BytesIO(source))
239 + book["Notes"].append([
240 + "001", 1404, "EQ", "Equity", "E01", "Equity note", "", "",
241 + ])
242 + headers = SHEET_HEADERS["Mapping"]
243 + base = {
244 + header: book["Mapping"].cell(2, index + 1).value
245 + for index, header in enumerate(headers)
246 + }
247 + equity_mapping = dict(base)
248 + equity_mapping.update({
249 + "mapping_id": "M-EQ-001", "target_statement": "EQ",
250 + "statement_section": "Equity", "note_number": "E01",
251 + })
252 + book["Mapping"].append([
253 + equity_mapping.get(header) for header in headers
254 + ])
255 + updated = BytesIO()
256 + book.save(updated)
257 + book.close()
258 +
259 + result = reconcile_workbook_for_review(
260 + updated.getvalue(), company_code="001", fiscal_year=1404,
261 + references=[
262 + NoteReference("BS", "Assets", "N01", "", "126", "REF-BS"),
263 + NoteReference("EQ", "Equity", "E01", "", "110.25", "REF-EQ"),
264 + ],
265 + )
266 + assert result.matched_for_analyst_review
267 + assert result.account_count == 2
268 + assert result.candidate_mapped_accounts == 2
269 + assert result.blocked_accounts == 0
270 + notes = {(note.statement, note.note_number): note for note in result.notes}
271 + assert notes[("BS", "N01")].candidate_closing_exposure == "126"
272 + assert notes[("EQ", "E01")].candidate_closing_exposure == "110.25"
273 + assert all(note.matched for note in result.notes)