fix(statements): cleanup guard tests — удалены ложноположительные тесты (Fix round 2)
Обнаружено: test_inn_from_auditor_above_organization_inn_line не тестирует guard, т.к. org INN всегда раньше auditor block в реальных файлах. Без guard первый найденный INN всё равно организации (появляется раньше). Guard не differentiates этот сценарий. Удалены: - test_inn_skips_auditor_block — ложноположительный, docstring утверждал Review Focus, но тест проходит из-за порядка (org INN раньше auditor), не из-за guard. Функциональность покрыта test_one_c_header. - test_inn_from_auditor_above_organization_inn_line — guard не differentiates; добавлен в попытке тестировать сценарий, невозможный по дизайну. Оставлен test_inn_from_auditor_block_only_is_none — единственный тест, где guard реально нужен: без org INN, только auditor блок → guard исключает его, возвращает None. Guard работает корректно: тестирует edge case отсутствия org INN. Итог: 6 тестов, все честны относительно требований к guard. Refs #14 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Claude-Session: cedd7915-2efe-41e5-988c-a9117033598b
This commit is contained in:
parent
27ffde426a
commit
e6696fa440
@ -157,14 +157,6 @@ def test_missing_units_and_organization_warn(rules: Rules) -> None:
|
||||
assert any("организация" in warning for warning in warnings)
|
||||
|
||||
|
||||
def test_inn_skips_auditor_block(rules: Rules) -> None:
|
||||
"""Review Focus: ИНН аудитора (строка 16) не должен попасть в header.inn."""
|
||||
sheet = sheet_from_rows(ONE_C)
|
||||
header, _ = parse_header(sheet, rules, 1, 16, _block(sheet, rules))
|
||||
assert header.inn == "3249004697", f"Expected organization INN 3249004697, got {header.inn}"
|
||||
assert header.inn != "7716021332", "Auditor INN 7716021332 should not be included"
|
||||
|
||||
|
||||
def test_inn_from_auditor_block_only_is_none(rules: Rules) -> None:
|
||||
"""Guard test (a): without org INN, only auditor block ИНН — should be None."""
|
||||
sheet = sheet_from_rows(
|
||||
@ -192,38 +184,3 @@ def test_inn_from_auditor_block_only_is_none(rules: Rules) -> None:
|
||||
header, _ = parse_header(sheet, rules, 1, 9, _block(sheet, rules))
|
||||
|
||||
assert header.inn is None, f"Should not pick up auditor INN 9999999999, got {header.inn}"
|
||||
|
||||
|
||||
def test_inn_from_auditor_above_organization_inn_line(rules: Rules) -> None:
|
||||
"""Guard test (b): org INN before auditor block; guard excludes auditor INN.
|
||||
|
||||
Organization section (rows 1-4) has INN 1234567890.
|
||||
Auditor block starts at row 5 and has INN 7716021332.
|
||||
Guard searches up to row 4, finds org INN.
|
||||
"""
|
||||
sheet = sheet_from_rows(
|
||||
[
|
||||
[*at({3: "Бухгалтерский баланс"})],
|
||||
[*at({3: "на 31 декабря 2024 г."})],
|
||||
[*at({7: 'ООО "ЗАВОД"'})],
|
||||
[*at({2: "Идентификационный номер налогоплательщика", 33: "ИНН", 34: "1234567890"})],
|
||||
[*at({2: "Наименование аудиторской организации"})],
|
||||
[*at({2: 'АО "ЮНИКОН"'})],
|
||||
[
|
||||
*at(
|
||||
{
|
||||
2: "Идентификационный номер налогоплательщика аудиторской организации",
|
||||
33: "ИНН",
|
||||
34: "7716021332",
|
||||
}
|
||||
)
|
||||
],
|
||||
[*at({2: "Единица измерения", 7: "в тыс. рублей", 33: "по ОКЕИ", 34: "384"})],
|
||||
]
|
||||
)
|
||||
|
||||
header, _ = parse_header(sheet, rules, 1, 8, _block(sheet, rules))
|
||||
|
||||
assert header.inn == "1234567890", (
|
||||
f"Should pick organization INN 1234567890, not auditor INN 7716021332, got {header.inn}"
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user