arm-tabular-parser/api/tests/unit/parser/test_inn_rows_osv.py
Andrey Epifancev ad1a6ec10e ОСВ: правки финального ревью строк ИНН — реквизит по схеме, подсказка «над», страховка владельца, родитель после склейки (#35)
R-6 (design #22), R-7 (#23), R-8 (#24), R-9 (#25), R-10 (#26), H.1/H.2 (#27); словарь позиций соседей (T2.6/T3.3);
spec/design/README: текст предупреждения, цена ошибки design #1, ссылки на решение владельца 10 (M-3, M-4, M-5, M-8).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 16:27:02 +04:00

48 lines
1.9 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""Строки ИНН на уровне листа ОСВ: страховка после классификации (R-8, design №24; change osv-inn-rows-layouts, #35)."""
import pytest
from gridbuilder import L, M, sheet_from_rows
from src.parser.deadline import Deadline
from src.parser.osv import OsvParser
from src.parser.rules import Rules, load_rules
TIMEOUT_SECONDS = 60
DETAIL = "Детализация по субсчетам, субконто: Подразделения, Контрагенты"
A = (None, None, 760000, 760000, None, None)
INN_A = 7701234560
@pytest.fixture(scope="module")
def rules() -> Rules:
return load_rules()
def test_inn_glued_to_row_that_is_not_a_counterparty_needs_check(rules: Rules) -> None:
head: list[list[object]] = [
["ООО Зерновая"],
["Оборотно-сальдовая ведомость по счету 60"],
["Период: 9 месяцев 2025 г."],
[DETAIL],
["Выводимые данные: сумма"],
[],
["Субконто", M("Сальдо на начало периода", 2), M("Оборот за период", 2), M("Сальдо на конец периода", 2)],
[None, "Дебет", "Кредит", "Дебет", "Кредит", "Дебет", "Кредит"],
]
sheet = sheet_from_rows(
[
*head,
[L(0), "60.01", *A], # 9
[L(1), INN_A, *A], # 10
[L(1), "ООО Альфа", *A], # 11
[L(0), "Итого", *A],
]
)
document, warnings, ok = OsvParser(rules).parse_sheet(sheet, Deadline(TIMEOUT_SECONDS))
assert [(row.row_value, row.group_type) for row in document.rows][1:2] == [("ООО Альфа", "DEPARTMENT")]
assert not ok
expected = f"строка 10: ИНН {INN_A} отнесён к строке 11, но она не контрагент — проверьте"
assert expected in warnings, warnings