Skip to main content
Glama
test_llm_processor_agent.py2.1 kB
"""Unit tests for LLMProcessorAgent - Simplified.""" import pytest from unittest.mock import Mock class MockLLMProcessorAgent: """Mock implementation for testing.""" def process(self, content: str, instruction: str = ""): """Mock process method.""" if not content: return { "status": "error", "result": "", "error": "Empty content" } return { "status": "success", "result": f"Processed: {content[:50]}..." if len(content) > 50 else f"Processed: {content}", "instruction_used": instruction } class TestLLMProcessorAgent: """Test suite for LLMProcessorAgent.""" def setup_method(self): """Set up test fixtures.""" self.agent = MockLLMProcessorAgent() def test_process_success(self): """Test successful content processing.""" # Setup content = "This is some content to process" instruction = "Summarize this content" # Execute result = self.agent.process(content, instruction) # Verify assert result["status"] == "success" assert "Processed:" in result["result"] assert result["instruction_used"] == instruction def test_process_empty_content(self): """Test processing with empty content.""" # Execute result = self.agent.process("", "summarize") # Verify assert result["status"] == "error" assert "error" in result def test_process_long_content(self): """Test processing with long content.""" # Setup content = "This is a very long piece of content that should be truncated in the mock response to test handling of large text." # Execute result = self.agent.process(content) # Verify assert result["status"] == "success" assert "..." in result["result"] # Should be truncated

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/CodeHalwell/gradio-mcp-agent-hack'

If you have feedback or need assistance with the MCP directory API, please join our Discord server