Spaces:
Runtime error
Runtime error
| # 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 |