VALUE_OUT_OF_RANGE: line_refs — ref строки, не ячейки значения (I-2)
Адрес ячейки остаётся в message. Добавлен инвариант-тест по golden: line_refs предупреждений документа входят в ref строк, locator нет, column_index есть среди колонок. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BJKMLHdxMwSUeYcdkwqX4W
This commit is contained in:
parent
be3b9c8905
commit
8a63ce5196
@ -42,7 +42,7 @@ def build_lines(
|
|||||||
message = f"значение ячейки {cell.ref} вне диапазона numeric(18,2)"
|
message = f"значение ячейки {cell.ref} вне диапазона numeric(18,2)"
|
||||||
warnings.append(
|
warnings.append(
|
||||||
make_warning(
|
make_warning(
|
||||||
WarningCode.VALUE_OUT_OF_RANGE, message, rules, line_refs=(cell.ref,), column_index=column_index
|
WarningCode.VALUE_OUT_OF_RANGE, message, rules, line_refs=(item.ref,), column_index=column_index
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
lines.append(
|
lines.append(
|
||||||
|
|||||||
@ -157,3 +157,15 @@ def test_npz_continuation_single_code(rules: Rules) -> None: # Review Focus 5
|
|||||||
assert [v.amount for v in line_2400.values] == [D("264"), D("238")]
|
assert [v.amount for v in line_2400.values] == [D("264"), D("238")]
|
||||||
assert "," in doc.locator and not [w for w in doc.warnings if w.code.startswith("SEGMENT_")]
|
assert "," in doc.locator and not [w for w in doc.warnings if w.code.startswith("SEGMENT_")]
|
||||||
assert doc.status is DocStatus.DONE
|
assert doc.status is DocStatus.DONE
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("name", NAMES)
|
||||||
|
def test_document_warnings_reference_document_parts(name: str, rules: Rules) -> None:
|
||||||
|
"""I-2: line_refs предупреждения — ref строк документа; locator нет; column_index — из колонок."""
|
||||||
|
doc = run(name, rules)
|
||||||
|
line_refs = {ln.ref for ln in doc.lines}
|
||||||
|
column_indexes = {c.column_index for c in doc.columns}
|
||||||
|
for warning in doc.warnings:
|
||||||
|
assert set(warning.line_refs) <= line_refs, warning
|
||||||
|
assert warning.locator is None, warning
|
||||||
|
assert warning.column_index is None or warning.column_index in column_indexes, warning
|
||||||
|
|||||||
@ -37,7 +37,7 @@ def test_value_out_of_range_warning(rules: Rules) -> None:
|
|||||||
lines, warnings = statement_lines(cand, rules)
|
lines, warnings = statement_lines(cand, rules)
|
||||||
assert lines[0].values[0].amount is None
|
assert lines[0].values[0].amount is None
|
||||||
assert [(w.code, w.severity, w.line_refs, w.column_index) for w in warnings] == [
|
assert [(w.code, w.severity, w.line_refs, w.column_index) for w in warnings] == [
|
||||||
("VALUE_OUT_OF_RANGE", Severity.INFO, ("Баланс!C2",), 2)
|
("VALUE_OUT_OF_RANGE", Severity.INFO, ("Баланс!B2",), 2)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user