Files
OpenJarvis/tests/tools/test_think.py
T
2026-03-12 17:29:39 +00:00

38 lines
1.1 KiB
Python

"""Tests for the think tool."""
from __future__ import annotations
from openjarvis.tools.think import ThinkTool
class TestThinkTool:
def test_spec(self):
tool = ThinkTool()
assert tool.spec.name == "think"
assert tool.spec.category == "reasoning"
assert tool.spec.cost_estimate == 0.0
def test_echoes_thought(self):
tool = ThinkTool()
result = tool.execute(thought="Let me think step by step...")
assert result.success is True
assert result.content == "Let me think step by step..."
def test_empty_thought(self):
tool = ThinkTool()
result = tool.execute(thought="")
assert result.success is True
assert result.content == ""
def test_no_thought(self):
tool = ThinkTool()
result = tool.execute()
assert result.success is True
assert result.content == ""
def test_openai_function(self):
tool = ThinkTool()
fn = tool.to_openai_function()
assert fn["function"]["name"] == "think"
assert "thought" in fn["function"]["parameters"]["properties"]