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

This commit is contained in:
2026-08-20 13:12:50 +00:00
commit b119135836
10275 changed files with 3284984 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
"""Test import bootstrap for the async-agent experiment."""
from pathlib import Path
import sys
EXPERIMENT_ROOT = Path(__file__).resolve().parents[1]
if str(EXPERIMENT_ROOT) not in sys.path:
sys.path.insert(0, str(EXPERIMENT_ROOT))
@@ -0,0 +1,35 @@
"""回归测试:FLUX_TICK_REAL 等浮点环境变量非法时不得让模块导入崩溃。
tasks.py 原来在模块导入时用裸 float() 解析 FLUX_TICK_REAL
FLUX_TICK_REAL=abc 会让整个演示脚本以 ValueError 崩溃;现在回退到默认值并打印警告。
"""
import importlib
import os
import sys
sys.path.insert(0, os.path.dirname(__file__))
import tasks
def test_env_float_falls_back_on_malformed(monkeypatch, capsys):
monkeypatch.setenv("FLUX_TICK_REAL", "abc")
assert tasks._env_float("FLUX_TICK_REAL", 0.4) == 0.4
assert "FLUX_TICK_REAL" in capsys.readouterr().out
def test_env_float_parses_valid_value(monkeypatch):
monkeypatch.setenv("FLUX_TICK_REAL", "0.1")
assert tasks._env_float("FLUX_TICK_REAL", 0.4) == 0.1
def test_env_float_default_when_unset(monkeypatch):
monkeypatch.delenv("FLUX_TICK_REAL", raising=False)
assert tasks._env_float("FLUX_TICK_REAL", 0.4) == 0.4
def test_module_reload_survives_malformed_env(monkeypatch):
"""模块级 TICK_REAL 在环境变量非法时不得抛出 ValueError。"""
monkeypatch.setenv("FLUX_TICK_REAL", "fast")
importlib.reload(tasks)
assert tasks.TICK_REAL == 0.4