53 lines
1.9 KiB
Python
53 lines
1.9 KiB
Python
#!/usr/bin/env python3
|
|
"""20 项研究机制覆盖矩阵的机械卫生门。"""
|
|
from __future__ import annotations
|
|
|
|
import pathlib
|
|
import unittest
|
|
|
|
import yaml
|
|
|
|
ROOT = pathlib.Path(__file__).resolve().parent.parent
|
|
PROJECT_ROOT = next(
|
|
parent
|
|
for parent in (ROOT, *ROOT.parents)
|
|
if (parent / "AGENTS.md").is_file() and (parent / ".git").exists()
|
|
)
|
|
MATRIX = ROOT / "research/20-project-skill-coverage.yaml"
|
|
|
|
|
|
class FrameworkCoverageTest(unittest.TestCase):
|
|
def test_matrix_has_skill_owners_and_real_implementation_paths(self):
|
|
data = yaml.safe_load(MATRIX.read_text(encoding="utf-8"))
|
|
self.assertEqual(data["schema_version"], "humanization-research-skill-coverage-v1")
|
|
capabilities = data["capabilities"]
|
|
self.assertGreaterEqual(len(capabilities), 12)
|
|
capability_ids = {item["id"] for item in capabilities}
|
|
projects = data["projects"]
|
|
self.assertEqual(len(projects), 20)
|
|
self.assertEqual(len({item["id"] for item in projects}), 20)
|
|
for project in projects:
|
|
self.assertTrue(project["mapped_capabilities"], project["id"])
|
|
self.assertTrue(set(project["mapped_capabilities"]) <= capability_ids, project["id"])
|
|
owners = {item["owner_skill"] for item in capabilities}
|
|
self.assertEqual(
|
|
owners,
|
|
{
|
|
"建立作品声音档案",
|
|
"预防机器味",
|
|
"诊断机器味",
|
|
"修正正文机器味",
|
|
"记录机器味案例",
|
|
"建立机器味规则",
|
|
},
|
|
)
|
|
for item in capabilities:
|
|
implementation_ref = item["implementation"]
|
|
implementation = PROJECT_ROOT / implementation_ref
|
|
self.assertTrue(implementation.exists(), f"{item['id']}: {implementation}")
|
|
self.assertIn(item["status"], {"implemented", "partial", "pending"})
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|