expose itempolicy to the wf_authoring

This commit is contained in:
lda
2026-05-23 21:42:37 +07:00 Verified
parent 1c5cf15815
commit e09d714c72
6 changed files with 361 additions and 4 deletions
+30
View File
@@ -41,6 +41,36 @@ def test_deprecated_on_item_error_parses_to_nested_policy() -> None:
assert dumped["item_error"]["action"] == "skip"
def test_item_error_string_parses_to_policy_action() -> None:
node = ForeachNode.model_validate(
{
"id": "each",
"type": "foreach",
"over": "state.items",
"as": "item",
"item_error": "skip",
}
)
dumped = node.model_dump(mode="json", by_alias=True)
assert node.item_error.action == "skip"
assert dumped["item_error"]["action"] == "skip"
def test_collect_item_error_string_explains_required_shape() -> None:
with pytest.raises(ValidationError, match="collect_to"):
ForeachNode.model_validate(
{
"id": "each",
"type": "foreach",
"over": "state.items",
"as": "item",
"item_error": "collect",
}
)
def test_collect_item_policy_requires_collect_to() -> None:
with pytest.raises(ValidationError, match="collect_to"):
ForeachNode.model_validate(