File size: 1,014 Bytes
2929135
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# tests/test_nodes/test_input_analyzer.py
import pytest
from src.nodes.input_analyzer import InputAnalyzerNode
from src.models.state import TaskType, PriorityLevel

def test_input_analyzer_initialization(mock_llm_response):
    """Test InputAnalyzer node initialization"""
    analyzer = InputAnalyzerNode(mock_llm_response)
    assert analyzer is not None

def test_input_analysis(mock_hospital_state, mock_llm_response):
    """Test input analysis functionality"""
    analyzer = InputAnalyzerNode(mock_llm_response)
    result = analyzer(mock_hospital_state)
    
    assert "current_task" in result
    assert "priority_level" in result
    assert isinstance(result["current_task"], TaskType)
    assert isinstance(result["priority_level"], PriorityLevel)

def test_invalid_input_handling(mock_hospital_state):
    """Test handling of invalid input"""
    analyzer = InputAnalyzerNode(None)
    mock_hospital_state["messages"] = []
    
    with pytest.raises(ValueError):
        analyzer(mock_hospital_state)