Skip to content

Commit

Permalink
fix(tests): handle invalid variable type for document_extractor_node
Browse files Browse the repository at this point in the history
- Imported StringVariable to properly mock an invalid variable type.
- Enhanced test case `test_run_invalid_variable_type` to use StringVariable instead of a plain string.
  • Loading branch information
laipz8200 committed Sep 30, 2024
1 parent 7911105 commit e360eb6
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from core.file import File, FileTransferMethod
from core.variables import ArrayFileSegment
from core.variables.variables import StringVariable
from core.workflow.entities.node_entities import NodeRunResult
from core.workflow.nodes.document_extractor import DocumentExtractorNode, DocumentExtractorNodeData
from core.workflow.nodes.document_extractor.document_extractor_node import (
Expand Down Expand Up @@ -51,7 +52,9 @@ def test_run_variable_not_found(document_extractor_node, mock_graph_runtime_stat

def test_run_invalid_variable_type(document_extractor_node, mock_graph_runtime_state):
document_extractor_node.graph_runtime_state = mock_graph_runtime_state
mock_graph_runtime_state.variable_pool.get.return_value = "Not an ArrayFileSegment"
mock_graph_runtime_state.variable_pool.get.return_value = StringVariable(
value="Not an ArrayFileSegment", name="test"
)

result = document_extractor_node._run()

Expand Down

0 comments on commit e360eb6

Please sign in to comment.