46 lines
2.3 KiB
Python
46 lines
2.3 KiB
Python
"""Реальные входы таблицы корректировок, Срез 5 / AURORA-1540.
|
||
|
||
Источник: golden/expected_osv_parse/{rb,schastl}/2024-Q3 в fixtures.
|
||
Загрузчик общий с проверками шахматки: выбирает документ/счёт/строку и БУ.
|
||
106311116.46 — встречная задолженность по правилу №6, не сумма всего
|
||
агрегата (у Счастливочной есть другие позиции по тому же правилу).
|
||
42000000.00 — только кредит 66.03 РБ: встречной ОСВ 58.03 в наборе нет.
|
||
Не подменяем отсутствие источника синтетической дебетовой строкой.
|
||
"""
|
||
|
||
from decimal import Decimal
|
||
from pathlib import Path
|
||
|
||
import pytest
|
||
|
||
from tests.test_intercompany_matrix_golden import _source
|
||
|
||
pytestmark = pytest.mark.fixtures
|
||
|
||
|
||
@pytest.fixture
|
||
def correction_source_rows(fixtures_dir: Path) -> dict[str, dict]:
|
||
"""Исходные строки с неизменёнными суммами, счетами и именами контрагентов."""
|
||
return {
|
||
"receivable": _source(fixtures_dir, "schastl", "62", 21),
|
||
"payable": _source(fixtures_dir, "rb", "60", 409),
|
||
"loan_payable": _source(fixtures_dir, "rb", "66", 25),
|
||
}
|
||
|
||
|
||
def test_correction_trade_sources_are_reciprocal(correction_source_rows: dict[str, dict]) -> None:
|
||
debit = correction_source_rows["receivable"]
|
||
credit = correction_source_rows["payable"]
|
||
assert (debit["account_code_raw"], credit["account_code_raw"]) == ("62.01", "60.01")
|
||
assert debit["counterparty_inn"] == "3528052718"
|
||
assert "СЧАСТЛИВОЧНАЯ" in credit["counterparty_name"]
|
||
assert Decimal(debit["closing_debit"]) == Decimal(credit["closing_credit"]) == Decimal("106311116.46")
|
||
|
||
|
||
def test_correction_loan_source_is_one_sided(correction_source_rows: dict[str, dict]) -> None:
|
||
credit = correction_source_rows["loan_payable"]
|
||
assert credit["account_code_raw"] == "66.03"
|
||
assert "СЧАСТЛИВОЧНАЯ" in credit["counterparty_name"]
|
||
assert Decimal(credit["closing_credit"]) == Decimal("42000000.00")
|
||
assert Decimal(credit["closing_debit"] or "0") == 0
|