test_product_efficiency_skill_contract.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. from pathlib import Path
  2. PROJECT = Path(__file__).parents[1]
  3. SKILL_DIR = PROJECT / ".agents" / "skills" / "odps-product-efficiency-report"
  4. def test_return_attribution_fields_are_explicit() -> None:
  5. contract = "\n".join(
  6. [
  7. (SKILL_DIR / "SKILL.md").read_text(encoding="utf-8"),
  8. (SKILL_DIR / "references" / "metrics.md").read_text(encoding="utf-8"),
  9. (SKILL_DIR / "references" / "raw-output-contract.md").read_text(encoding="utf-8"),
  10. ]
  11. )
  12. assert "topic='share'" in contract
  13. assert "topic='click'" in contract
  14. assert "type='share'" in contract
  15. assert "Never use `type='share'`" in contract
  16. def test_generic_catalog_uses_topic_for_return_chain() -> None:
  17. catalog = (
  18. PROJECT / ".agents" / "skills" / "query-odps-data" / "references" / "data-catalog.md"
  19. ).read_text(encoding="utf-8")
  20. assert "源分享使用 `topic='share'`" in catalog
  21. assert "点击使用 `topic='click'`" in catalog
  22. assert "禁止用 `type='share'` 判断源分享" in catalog
  23. def test_realtime_total_only_contract_is_explicit() -> None:
  24. skill = (SKILL_DIR / "SKILL.md").read_text(encoding="utf-8")
  25. raw_contract = (SKILL_DIR / "references" / "raw-output-contract.md").read_text(
  26. encoding="utf-8"
  27. )
  28. assert "仅全量" in skill
  29. assert "`dt LIKE 'yyyyMMdd%'`" in skill
  30. assert "Overall-only variant" in raw_contract
  31. assert "do not run the 16-bucket formatter" in raw_contract