File size: 787 Bytes
f4f9835
4a30717
f4f9835
 
 
 
 
 
 
 
 
4a30717
f4f9835
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# tests/test_input_handler.py
import pytest
from modules.input_handler import InputHandler

def test_process_query_valid():
    handler = InputHandler()
    result = handler.process_query("  Climate change and agriculture  ")
    assert result == "Climate change and agriculture"

def test_process_query_too_short():
    handler = InputHandler()
    with pytest.raises(ValueError, match="Query too short. Please provide more details."):
        handler.process_query("AI")

def test_extract_keywords():
    handler = InputHandler()
    result = handler.extract_keywords("The latest developments in AI research")
    assert "latest" in result
    assert "developments" in result
    assert "ai" in result
    assert "research" in result
    assert "the" not in result  # stop word removed