feat: implement DCOS source tree, tests, and build configuration
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
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
"""
|
||||
Tests for EpisodicMemory.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from dcos.memory.episodic import EpisodicMemory
|
||||
|
||||
|
||||
class TestEpisodicMemory:
|
||||
def test_record_and_recall(self):
|
||||
mem = EpisodicMemory()
|
||||
ep = mem.record({"action": "test"}, "success", "test episode")
|
||||
assert ep.summary == "test episode"
|
||||
|
||||
def test_recall_recent(self):
|
||||
mem = EpisodicMemory()
|
||||
for i in range(5):
|
||||
mem.record({"i": i}, f"outcome_{i}")
|
||||
recent = mem.recall_recent(3)
|
||||
assert len(recent) == 3
|
||||
|
||||
def test_search_by_context(self):
|
||||
mem = EpisodicMemory()
|
||||
mem.record({"type": "exploration"}, "found gold")
|
||||
mem.record({"type": "exploitation"}, "mined ore")
|
||||
results = mem.search_by_context("type", "exploration")
|
||||
assert len(results) == 1
|
||||
|
||||
def test_count(self):
|
||||
mem = EpisodicMemory()
|
||||
assert mem.episode_count() == 0
|
||||
mem.record({}, "outcome")
|
||||
assert mem.episode_count() == 1
|
||||
Reference in New Issue
Block a user