""" Unit tests for agent functionality """ import pytest from unittest.mock import Mock, patch from src.agents.islamic_scholar_agent import IslamicScholarAgent from src.models.openai import OpenAILikeModel class TestIslamicScholarAgent: """Test cases for Islamic Scholar Agent""" @pytest.fixture def mock_model(self): """Mock model for testing""" model = Mock() model.get_model.return_value = Mock() return model @pytest.fixture def mock_knowledge_base(self): """Mock knowledge base for testing""" kb = Mock() return kb def test_agent_initialization(self, mock_model, mock_knowledge_base): """Test agent initialization""" agent = IslamicScholarAgent(mock_model.get_model(), mock_knowledge_base) assert agent.model == mock_model.get_model() assert agent.knowledge_base == mock_knowledge_base assert agent.agent is not None def test_agent_instructions(self, mock_model, mock_knowledge_base): """Test agent has correct Islamic instructions""" agent = IslamicScholarAgent(mock_model.get_model(), mock_knowledge_base) instructions = agent.agent.instructions assert "Islamic knowledge agent" in " ".join(instructions).lower() assert "knowledge base" in " ".join(instructions).lower() def test_get_agent_method(self, mock_model, mock_knowledge_base): """Test get_agent method returns configured agent""" agent = IslamicScholarAgent(mock_model.get_model(), mock_knowledge_base) returned_agent = agent.get_agent() assert returned_agent == agent.agent