Skip to content

Commit 26edefc

Browse files
committed
test/fix: add test to get 100% coverage and fix mypy errors
1 parent f29e229 commit 26edefc

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

pydantic_deep/toolsets/subagents.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,14 @@ async def task( # pragma: no cover
122122
subagent = ctx.deps.subagents[subagent_type]
123123
else:
124124
# Create the subagent on-the-fly
125+
from pydantic_ai_backends import create_console_toolset
125126
from pydantic_ai_todo import create_todo_toolset
126127

127-
from pydantic_deep.toolsets.filesystem import create_filesystem_toolset
128-
129128
model = config.get("model", default_model)
130129
tools = config.get("tools", [])
131130

132131
# Create toolsets for the subagent
133-
fs_toolset = create_filesystem_toolset(
132+
console_toolset = create_console_toolset(
134133
include_execute=True,
135134
require_write_approval=False,
136135
require_execute_approval=False,
@@ -141,7 +140,7 @@ async def task( # pragma: no cover
141140
model,
142141
instructions=config["instructions"],
143142
deps_type=type(ctx.deps),
144-
toolsets=[fs_toolset, todo_toolset],
143+
toolsets=[console_toolset, todo_toolset],
145144
)
146145

147146
# Add custom tools if any

tests/test_agent_extended.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,22 @@ def test_post_init_syncs_files(self):
144144
# Files should be synced to backend
145145
assert "/test.txt" in backend.files
146146

147+
def test_post_init_with_non_state_backend(self, local_backend):
148+
"""Test that __post_init__ works with non-StateBackend."""
149+
# This covers the branch where backend is NOT a StateBackend
150+
deps = DeepAgentDeps(backend=local_backend)
151+
assert deps.backend is local_backend
152+
# files dict should remain empty (not synced from backend)
153+
assert deps.files == {}
154+
155+
def test_get_files_summary_empty(self):
156+
"""Test get_files_summary with empty files."""
157+
deps = DeepAgentDeps(backend=StateBackend())
158+
# Ensure files is empty
159+
deps.files.clear()
160+
summary = deps.get_files_summary()
161+
assert summary == ""
162+
147163
def test_get_files_summary_with_files(self):
148164
"""Test get_files_summary with files."""
149165
deps = DeepAgentDeps(backend=StateBackend())

0 commit comments

Comments
 (0)