Complete implementation of the DCOS package including: - 40+ Python source files across agents, communication, core, learning, memory, protocols, utils - pyproject.toml build configuration - 102 unit tests across all subsystems - Fixed flake.nix (Python 3.12, proper dependencies, pyproject build) - Fixed .woodpecker.yml (correct paths, removed silent-fail flags) - Added .gitignore - Cleared stale pytest cache
34 lines
1011 B
Python
34 lines
1011 B
Python
"""
|
|
Tests for ProceduralMemory.
|
|
"""
|
|
|
|
import pytest
|
|
from dcos.memory.procedural import ProceduralMemory
|
|
|
|
|
|
class TestProceduralMemory:
|
|
def test_register_procedure(self):
|
|
mem = ProceduralMemory()
|
|
mem.register_procedure("build", ["init", "compile", "link"])
|
|
proc = mem.get_procedure("build")
|
|
assert proc is not None
|
|
assert len(proc["steps"]) == 3
|
|
|
|
def test_execute_procedure(self):
|
|
mem = ProceduralMemory()
|
|
mem.register_procedure("test_proc", ["step1", "step2"])
|
|
result = mem.execute_procedure("test_proc", {})
|
|
assert result["executed"] is True
|
|
|
|
def test_missing_procedure(self):
|
|
mem = ProceduralMemory()
|
|
with pytest.raises(KeyError):
|
|
mem.execute_procedure("nonexistent", {})
|
|
|
|
def test_list_procedures(self):
|
|
mem = ProceduralMemory()
|
|
mem.register_procedure("a", ["a1"])
|
|
mem.register_procedure("b", ["b1"])
|
|
procs = mem.list_procedures()
|
|
assert len(procs) == 2
|