Add complete Kaizen Agentic framework foundation
- Essential project files: .gitignore, pyproject.toml, README.md - Documentation framework: CHANGELOG.md, CONTRIBUTING.md, TODO.md, CLAUDE.md - 15 specialized agent definitions for comprehensive development workflow - Core source code structure with optimization framework - Testing infrastructure with example tests - Proper Python package structure following PythonVibes standards This establishes the complete foundation for the AI agent development framework with agent-driven workflows, continuous improvement principles, and comprehensive development infrastructure. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
117
tests/test_core.py
Normal file
117
tests/test_core.py
Normal file
@@ -0,0 +1,117 @@
|
||||
"""
|
||||
Test for core agent functionality.
|
||||
|
||||
This test module validates the core Agent and AgentConfig classes.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from kaizen_agentic.core import Agent, AgentConfig
|
||||
|
||||
|
||||
class TestAgentConfig:
|
||||
"""Test suite for AgentConfig functionality."""
|
||||
|
||||
def setup_method(self):
|
||||
"""Set up test environment."""
|
||||
self.config_data = {
|
||||
"name": "test-agent",
|
||||
"description": "Test agent for validation",
|
||||
"model": "test-model",
|
||||
}
|
||||
|
||||
def teardown_method(self):
|
||||
"""Clean up after tests."""
|
||||
pass
|
||||
|
||||
def test_basic_functionality(self):
|
||||
"""Test basic AgentConfig functionality."""
|
||||
# Arrange
|
||||
config = AgentConfig(**self.config_data)
|
||||
|
||||
# Act & Assert
|
||||
assert config.name == "test-agent"
|
||||
assert config.description == "Test agent for validation"
|
||||
assert config.model == "test-model"
|
||||
assert config.metadata == {}
|
||||
|
||||
def test_metadata_initialization(self):
|
||||
"""Test metadata initialization."""
|
||||
# Arrange & Act
|
||||
config = AgentConfig(name="test", description="test", metadata={"key": "value"})
|
||||
|
||||
# Assert
|
||||
assert config.metadata == {"key": "value"}
|
||||
|
||||
def test_default_metadata(self):
|
||||
"""Test default metadata initialization."""
|
||||
# Arrange & Act
|
||||
config = AgentConfig(name="test", description="test")
|
||||
|
||||
# Assert
|
||||
assert config.metadata == {}
|
||||
|
||||
|
||||
class MockAgent(Agent):
|
||||
"""Mock agent implementation for testing."""
|
||||
|
||||
def execute(self, task: str, context=None):
|
||||
"""Mock execution that returns test data."""
|
||||
return {
|
||||
"result": f"Executed: {task}",
|
||||
"success": True,
|
||||
"execution_time": 1.0,
|
||||
}
|
||||
|
||||
|
||||
class TestAgent:
|
||||
"""Test suite for Agent functionality."""
|
||||
|
||||
def setup_method(self):
|
||||
"""Set up test environment."""
|
||||
self.config = AgentConfig(
|
||||
name="mock-agent", description="Mock agent for testing"
|
||||
)
|
||||
self.agent = MockAgent(self.config)
|
||||
|
||||
def teardown_method(self):
|
||||
"""Clean up after tests."""
|
||||
pass
|
||||
|
||||
def test_basic_functionality(self):
|
||||
"""Test basic Agent functionality."""
|
||||
# Arrange
|
||||
task = "test task"
|
||||
|
||||
# Act
|
||||
result = self.agent.execute(task)
|
||||
|
||||
# Assert
|
||||
assert result["result"] == "Executed: test task"
|
||||
assert result["success"] is True
|
||||
|
||||
def test_performance_recording(self):
|
||||
"""Test performance metrics recording."""
|
||||
# Arrange
|
||||
metrics = {"execution_time": 2.5, "success_rate": 0.95}
|
||||
|
||||
# Act
|
||||
self.agent.record_performance(metrics)
|
||||
|
||||
# Assert
|
||||
assert len(self.agent.performance_history) == 1
|
||||
assert self.agent.performance_history[0] == metrics
|
||||
|
||||
def test_configuration_update(self):
|
||||
"""Test agent configuration updates."""
|
||||
# Arrange
|
||||
updates = {"new_param": "new_value"}
|
||||
|
||||
# Act
|
||||
self.agent.update_configuration(updates)
|
||||
|
||||
# Assert
|
||||
assert self.agent.config.metadata["new_param"] == "new_value"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
pytest.main([__file__, "-v"])
|
||||
Reference in New Issue
Block a user