Add project tools and strict provider execution
This commit is contained in:
@@ -105,6 +105,25 @@ class TestToolArgument:
|
||||
with pytest.raises(ValueError):
|
||||
ToolArgument(flag="--value", variable="value", **values)
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("legacy_type", "canonical_type"),
|
||||
[
|
||||
("str", "string"),
|
||||
("int", "integer"),
|
||||
("float", "number"),
|
||||
("bool", "boolean"),
|
||||
],
|
||||
)
|
||||
def test_legacy_scalar_type_aliases_are_normalized(
|
||||
self, legacy_type, canonical_type
|
||||
):
|
||||
argument = ToolArgument(
|
||||
flag="--value", variable="value", type=legacy_type
|
||||
)
|
||||
|
||||
assert argument.type == canonical_type
|
||||
assert argument.to_dict().get("type", "string") == canonical_type
|
||||
|
||||
|
||||
class TestPromptStep:
|
||||
"""Tests for PromptStep dataclass."""
|
||||
@@ -686,6 +705,23 @@ class TestAgentContext:
|
||||
restored = PromptStep.from_dict(step.to_dict())
|
||||
assert restored.skills == ["python"]
|
||||
|
||||
def test_promptstep_deny_fallback_roundtrip(self):
|
||||
step = PromptStep(
|
||||
prompt="Private", provider="local", output_var="out",
|
||||
fallback_policy="deny",
|
||||
)
|
||||
|
||||
restored = PromptStep.from_dict(step.to_dict())
|
||||
|
||||
assert restored.fallback_policy == "deny"
|
||||
|
||||
def test_promptstep_rejects_invalid_fallback_policy(self):
|
||||
with pytest.raises(ValueError, match="fallback_policy"):
|
||||
PromptStep(
|
||||
prompt="Test", provider="local", output_var="out",
|
||||
fallback_policy="sometimes",
|
||||
)
|
||||
|
||||
|
||||
class TestDeprecationFields:
|
||||
def test_round_trip_and_warning(self):
|
||||
|
||||
Reference in New Issue
Block a user