ai-agent-book 精选快照(<2MB 代码与文档,来自 github.com/bojieli/ai-agent-book)
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
"""Null review issues must summarize without TypeError."""
|
||||
import sys
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
# demo.py imports heavy optional deps at module import time.
|
||||
sys.modules.setdefault("dotenv", MagicMock())
|
||||
sys.modules.setdefault("agents", MagicMock())
|
||||
sys.modules.setdefault("make_figures", MagicMock())
|
||||
sys.modules.setdefault("renderer", MagicMock())
|
||||
|
||||
from demo import summarize_review, _review_issues
|
||||
|
||||
|
||||
def test_null_issues_like_empty():
|
||||
assert _review_issues({"issues": None}) == []
|
||||
text = summarize_review({"overall_score": 90, "pass": True, "issues": None})
|
||||
assert "issues=0" in text
|
||||
assert "high=0" in text
|
||||
|
||||
|
||||
def test_issues_preserved():
|
||||
issues = [{"severity": "high"}]
|
||||
assert _review_issues({"issues": issues}) == issues
|
||||
text = summarize_review({"overall_score": 50, "pass": False, "issues": issues})
|
||||
assert "high=1" in text
|
||||
|
||||
|
||||
def test_non_dict_issue_items_dropped():
|
||||
assert _review_issues({"issues": [None, {"severity": "high"}, "x"]}) == [{"severity": "high"}]
|
||||
text = summarize_review({"overall_score": 40, "pass": False, "issues": [None, {"severity": "high"}]})
|
||||
assert "high=1" in text
|
||||
assert "issues=1" in text
|
||||
Reference in New Issue
Block a user