mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-02-09 06:15:41 -05:00
fix(backend): use isinstance for type narrowing in find_block tests
Replaces hasattr checks with isinstance(response, BlockListResponse) so pyright can narrow the type and see .blocks attribute. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -9,6 +9,7 @@ from backend.api.features.chat.tools.find_block import (
|
||||
COPILOT_EXCLUDED_BLOCK_TYPES,
|
||||
FindBlockTool,
|
||||
)
|
||||
from backend.api.features.chat.tools.models import BlockListResponse
|
||||
from backend.data.block import BlockType
|
||||
|
||||
from ._test_data import make_session
|
||||
@@ -89,7 +90,7 @@ class TestFindBlockFiltering:
|
||||
)
|
||||
|
||||
# Should only return the standard block, not the INPUT block
|
||||
assert hasattr(response, "blocks")
|
||||
assert isinstance(response, BlockListResponse)
|
||||
assert len(response.blocks) == 1
|
||||
assert response.blocks[0].id == "standard-block-id"
|
||||
|
||||
@@ -133,6 +134,6 @@ class TestFindBlockFiltering:
|
||||
)
|
||||
|
||||
# Should only return normal block, not SmartDecisionMakerBlock
|
||||
assert hasattr(response, "blocks")
|
||||
assert isinstance(response, BlockListResponse)
|
||||
assert len(response.blocks) == 1
|
||||
assert response.blocks[0].id == "normal-block-id"
|
||||
|
||||
Reference in New Issue
Block a user