""" Basic Tests for GAIA Agent - Stage 1 Validation Author: @mangubee Date: 2026-01-01 Tests for Stage 1: Foundation Setup - Agent initialization - StateGraph compilation - Basic question processing """ import pytest from src.agent import GAIAAgent from src.config import Settings class TestAgentInitialization: """Test agent initialization and configuration.""" def test_agent_init(self): """Test that agent can be initialized without errors.""" agent = GAIAAgent() assert agent is not None assert agent.graph is not None print("✓ Agent initialization successful") def test_settings_load(self): """Test that settings can be loaded.""" settings = Settings() assert settings is not None assert settings.max_retries == 3 assert settings.question_timeout == 1020 print("✓ Settings loaded successfully") class TestBasicExecution: """Test basic agent execution with placeholder logic.""" def test_simple_question(self): """Test agent with simple question.""" agent = GAIAAgent() answer = agent("What is 2+2?") assert isinstance(answer, str) assert len(answer) > 0 print(f"✓ Agent returned answer: {answer}") def test_long_question(self): """Test agent with longer question.""" agent = GAIAAgent() long_question = "Explain the significance of the French Revolution in European history and its impact on modern democracy." answer = agent(long_question) assert isinstance(answer, str) assert len(answer) > 0 print(f"✓ Agent handled long question, returned: {answer[:50]}...") def test_multiple_calls(self): """Test that agent can handle multiple sequential calls.""" agent = GAIAAgent() questions = [ "What is the capital of France?", "Who wrote Romeo and Juliet?", "What is 10 * 5?" ] for q in questions: answer = agent(q) assert isinstance(answer, str) assert len(answer) > 0 print(f"✓ Agent successfully processed {len(questions)} questions") class TestStateGraphStructure: """Test StateGraph structure and nodes.""" def test_graph_has_nodes(self): """Test that compiled graph has expected nodes.""" agent = GAIAAgent() # LangGraph compiled graphs don't expose node list directly in Stage 1 # Just verify graph exists and compiles assert agent.graph is not None print("✓ StateGraph compiled with expected structure") if __name__ == "__main__": print("\n" + "="*70) print("GAIA Agent - Stage 1 Basic Tests") print("="*70 + "\n") # Run tests manually for quick validation test_init = TestAgentInitialization() test_init.test_agent_init() test_init.test_settings_load() test_exec = TestBasicExecution() test_exec.test_simple_question() test_exec.test_long_question() test_exec.test_multiple_calls() test_graph = TestStateGraphStructure() test_graph.test_graph_has_nodes() print("\n" + "="*70) print("✓ All Stage 1 tests passed!") print("="*70 + "\n")