docs: 为全部代码补充中文注释并加入 AGENTS 注释规范
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
"""Echo 节点测试。
|
||||
|
||||
覆盖直接文本、绝对/相对文件 URI、默认文本和入口点启动等真实代码路径。
|
||||
"""
|
||||
|
||||
import runpy
|
||||
from pathlib import Path
|
||||
|
||||
@@ -6,6 +11,7 @@ from wov_sdk.models import InvokeRequest
|
||||
|
||||
|
||||
def test_invoke_text(tmp_path) -> None:
|
||||
"""验证直接传入 text 时节点原样写出文本。"""
|
||||
response = invoke(
|
||||
InvokeRequest(
|
||||
run_id="run_1",
|
||||
@@ -20,6 +26,7 @@ def test_invoke_text(tmp_path) -> None:
|
||||
|
||||
|
||||
def test_invoke_absolute_file(tmp_path) -> None:
|
||||
"""验证绝对路径 file_uri 的文件内容被读取为输入。"""
|
||||
source = tmp_path / "input.txt"
|
||||
source.write_text("from file", encoding="utf-8")
|
||||
response = invoke(
|
||||
@@ -35,6 +42,7 @@ def test_invoke_absolute_file(tmp_path) -> None:
|
||||
|
||||
|
||||
def test_invoke_relative_file(tmp_path, monkeypatch) -> None:
|
||||
"""验证相对路径 file_uri 以节点仓库根目录为基准解析。"""
|
||||
node_root = Path(__file__).resolve().parent.parent
|
||||
source = node_root / "relative_input.txt"
|
||||
source.write_text("relative", encoding="utf-8")
|
||||
@@ -55,6 +63,7 @@ def test_invoke_relative_file(tmp_path, monkeypatch) -> None:
|
||||
|
||||
|
||||
def test_invoke_default_text(tmp_path) -> None:
|
||||
"""验证无任何输入时节点返回默认文本。"""
|
||||
response = invoke(
|
||||
InvokeRequest(
|
||||
run_id="run_4",
|
||||
@@ -68,6 +77,7 @@ def test_invoke_default_text(tmp_path) -> None:
|
||||
|
||||
|
||||
def test_main_entrypoint(monkeypatch, tmp_path) -> None:
|
||||
"""验证 python -m wov_node_echo 会加载 echo manifest 并启动服务。"""
|
||||
module_path = Path(__file__).resolve().parent.parent / "wov_node_echo" / "__main__.py"
|
||||
captured = {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user