36 lines
1.0 KiB
Python
36 lines
1.0 KiB
Python
import unittest
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
SKILLS_MD = ROOT / "SKILLS.md"
|
|
SOURCES_LIST = ROOT / "codex" / "skills" / ".sources" / "superpowers.list"
|
|
SOURCE_REF = "来源:`codex/skills/.sources/superpowers.list`(第三方来源清单)。"
|
|
|
|
|
|
def read_sources_list() -> list[str]:
|
|
return [
|
|
line.strip()
|
|
for line in SOURCES_LIST.read_text(encoding="utf-8").splitlines()
|
|
if line.strip() and not line.strip().startswith("#")
|
|
]
|
|
|
|
|
|
def read_skills_md() -> str:
|
|
return SKILLS_MD.read_text(encoding="utf-8")
|
|
|
|
|
|
class SuperpowersListSyncTests(unittest.TestCase):
|
|
def test_superpowers_section_routes_to_source_list(self):
|
|
self.assertTrue(read_sources_list())
|
|
|
|
text = read_skills_md()
|
|
|
|
self.assertIn(SOURCE_REF, text)
|
|
self.assertEqual(text.count("Third-party Skills (superpowers)"), 1)
|
|
self.assertNotIn("<!-- superpowers:skills:start -->", text)
|
|
self.assertNotIn("<!-- superpowers:skills:end -->", text)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|