code-to10 v6 A14 batch1: workers F601 duplicates and check_transplant E741 renames

(cherry picked from commit 4411186681584bf55e065c654fe909a3320d4a22)

Reconcile-conflict: test_skill_transplant_prep artifact count — kept HEAD's finalized 0 refs (2026-11-02 user sign-off deleting §4's 6 references, already in target) with incoming's l→line rename; incoming's 6-ref assertion is pre-finalization and must not overwrite.
This commit is contained in:
host committed 2026-11-03 02:49:26 +00:00
1 parent e00c255011
commit bd55599859
4 files changed
+26 -29

No files matched your search

+2 -2
View File
@@ -268,7 +268,7 @@ class TransplantPrepTestCase(unittest.TestCase):
self, {"cmd": "apply", "target_id": "v03"}, tmp_o)
self.assertEqual(result.returncode, 0, result.stderr)
lines = draft.read_text(encoding="utf-8").split("\n")
kept = [l for l in lines if not l.startswith("- 标记行:")]
kept = [line for line in lines if not line.startswith("- 标记行:")]
self.assertLess(len(kept), len(lines))
draft.write_text("\n".join(kept), encoding="utf-8")
check = subprocess.run(
@@ -282,7 +282,7 @@ class TransplantPrepTestCase(unittest.TestCase):
# v5 用户定稿(2026-11-02):§4 的 6 处引用经用户签字删除,
# 本测试由“钉住 6 处”改为“钉住 0 处”,防止删除后悄悄回潮。
text = SKILL_MD.read_text(encoding="utf-8")
refs = [l for l in text.split("\n") if "templates/artifacts" in l]
refs = [line for line in text.split("\n") if "templates/artifacts" in line]
self.assertEqual(len(refs), 0, refs)
self.assertIn("## 独立审计与自动推回", text)
# 集成基底章节表:审计章在 v0.5 表里编号为 11-auditor
+4 -4
View File
@@ -224,9 +224,9 @@ class ExtractTestCase(unittest.TestCase):
self.assertEqual(CT._lines("a\nb"), ["a", "b"])
lines = ["x", "y", "x"]
with self.assertRaises(ValueError):
CT._find_exact(lines, lambda l: l == "z", "missing")
CT._find_exact(lines, lambda line: line == "z", "missing")
with self.assertRaises(ValueError):
CT._find_exact(lines, lambda l: l == "x", "duplicated")
CT._find_exact(lines, lambda line: line == "x", "duplicated")
err = io.StringIO()
with contextlib.redirect_stderr(err):
self.assertEqual(CT.fail("boom"), 1)
@@ -431,8 +431,8 @@ class CheckTransplantedTestCase(unittest.TestCase):
def test_check_marker_and_matrix_errors(self):
draft = self._draft("v03")
target = _target_fixture("v03")
dropped = "\n".join(l for l in draft.split("\n")
if not l.startswith("- 标记行:"))
dropped = "\n".join(line for line in draft.split("\n")
if not line.startswith("- 标记行:"))
errors = CT.check_transplanted(target, dropped, "v03")
self.assertTrue(any("preserved marker lost" in e for e in errors))
no_row = draft.replace("| 独立审计 | 1 | 只写审计记录 | 审计结论 |\n", "")