|
@@ -591,11 +591,16 @@ def _expect_label(line: ConclusionView, formula: str) -> str:
|
|
|
return f"期望 {expected}"
|
|
return f"期望 {expected}"
|
|
|
|
|
|
|
|
|
|
|
|
|
-def _actual_text(line: ConclusionView, formula: str, subst: str) -> str:
|
|
|
|
|
- """实据:代入式和当前值。代入式与公式重复时不写。"""
|
|
|
|
|
|
|
+def _actual_text(line: ConclusionView, formula: str, subst: str, notes: Sequence[str] = ()) -> str:
|
|
|
|
|
+ """实据:代入式和当前值。代入式与公式重复时不写。
|
|
|
|
|
+
|
|
|
|
|
+ 有说明段且算不出期望值时,首段是正向门槛期望,不塞进实据;原因在结论说明里。
|
|
|
|
|
+ """
|
|
|
|
|
|
|
|
current = _value_text(line.check_value)
|
|
current = _value_text(line.check_value)
|
|
|
current_text = "当前缺失" if current is None else f"当前 {current}"
|
|
current_text = "当前缺失" if current is None else f"当前 {current}"
|
|
|
|
|
+ if line.calc_value is None and notes:
|
|
|
|
|
+ return current_text
|
|
|
if subst and _show_substitution(formula, subst):
|
|
if subst and _show_substitution(formula, subst):
|
|
|
return f"{subst}。{current_text}"
|
|
return f"{subst}。{current_text}"
|
|
|
if line.calc_value is None:
|
|
if line.calc_value is None:
|
|
@@ -607,13 +612,22 @@ def _actual_text(line: ConclusionView, formula: str, subst: str) -> str:
|
|
|
|
|
|
|
|
|
|
|
|
|
def _conclusion(line: ConclusionView, notes: Sequence[str]) -> str:
|
|
def _conclusion(line: ConclusionView, notes: Sequence[str]) -> str:
|
|
|
- """结论句接上说明和原来的期望句。说明不再单独成行。"""
|
|
|
|
|
|
|
+ """结论句接上说明和原来的期望句。说明不再单独成行。
|
|
|
|
|
+
|
|
|
|
|
+ 错误且无期望数值、已有说明时,说明已含原因,不再追加「期望与当前不一致」。
|
|
|
|
|
+ """
|
|
|
|
|
|
|
|
bits = [VERDICT_LABEL[line.verdict]]
|
|
bits = [VERDICT_LABEL[line.verdict]]
|
|
|
for note in notes:
|
|
for note in notes:
|
|
|
cleaned = note.strip().rstrip("。")
|
|
cleaned = note.strip().rstrip("。")
|
|
|
if cleaned:
|
|
if cleaned:
|
|
|
bits.append(cleaned)
|
|
bits.append(cleaned)
|
|
|
|
|
+ if line.verdict == VERDICT_ERROR and notes and line.calc_value is None:
|
|
|
|
|
+ current = _value_text(line.check_value)
|
|
|
|
|
+ right = "当前缺失" if current is None else f"当前 {current}"
|
|
|
|
|
+ bits.append(right)
|
|
|
|
|
+ bits.append(_MISMATCH.rstrip("。"))
|
|
|
|
|
+ return "结论:" + "。".join(bits) + "。"
|
|
|
tail = expectation(line).strip().rstrip("。")
|
|
tail = expectation(line).strip().rstrip("。")
|
|
|
if tail:
|
|
if tail:
|
|
|
bits.append(tail)
|
|
bits.append(tail)
|
|
@@ -630,7 +644,7 @@ def _detail_block(line: ConclusionView, chain_name: str) -> str:
|
|
|
rows = [f"节点:{formula or '核对'}"]
|
|
rows = [f"节点:{formula or '核对'}"]
|
|
|
rows.extend(_scope_rows(chain_name, report, (owner,) if owner else ()))
|
|
rows.extend(_scope_rows(chain_name, report, (owner,) if owner else ()))
|
|
|
rows.append(f"期望:{_expect_label(line, formula)}")
|
|
rows.append(f"期望:{_expect_label(line, formula)}")
|
|
|
- rows.append(f"实据:{_actual_text(line, formula, subst)}")
|
|
|
|
|
|
|
+ rows.append(f"实据:{_actual_text(line, formula, subst, notes)}")
|
|
|
if basis:
|
|
if basis:
|
|
|
rows.append(f"依据:{basis}")
|
|
rows.append(f"依据:{basis}")
|
|
|
rows.append(_conclusion(line, notes))
|
|
rows.append(_conclusion(line, notes))
|