hypothetical demonstration of conversion to workflow friendly tools

This commit is contained in:
lda
2026-05-19 03:13:46 +07:00 Verified
parent e5f8dd1c31
commit 6a1610c510
4 changed files with 138 additions and 2 deletions
+37
View File
@@ -0,0 +1,37 @@
from __future__ import annotations
import warnings
from wf_core import RunStatus
from examples.wrapper_status_route import build_wrapper
from examples.wrapper_normalization import build_normalized_wrapper
def test_status_wrapper_uses_match_without_deprecation_warning() -> None:
with warnings.catch_warnings():
warnings.simplefilter("error", DeprecationWarning)
workflow = build_wrapper()
run = workflow.execute({"text": "hello"})
assert run.status == RunStatus.COMPLETED
assert run.output["message"] == "HELLO"
def test_normalized_wrapper_maps_raw_status_to_workflow_outcome() -> None:
workflow = build_normalized_wrapper()
success = workflow.execute({"text": "hello"})
needs_input = workflow.execute({"text": "clarify?"})
failed = workflow.execute({"text": ""})
assert success.status == RunStatus.COMPLETED
assert success.trace[-1].outcome == "done"
assert success.output["message"] == "HELLO"
assert needs_input.status == RunStatus.COMPLETED
assert needs_input.trace[-1].outcome == "needs_input"
assert needs_input.output["message"] == "Need clarification"
assert failed.status == RunStatus.COMPLETED
assert failed.trace[-1].outcome == "failed"
assert failed.output["message"] == "No text supplied"