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,42 @@
|
||||
"""
|
||||
Tests for WorkingMemory.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from dcos.memory.working import WorkingMemory
|
||||
|
||||
|
||||
class TestWorkingMemory:
|
||||
def test_store_and_recall(self):
|
||||
mem = WorkingMemory()
|
||||
mem.store("key1", "value1")
|
||||
assert mem.recall("key1") == "value1"
|
||||
|
||||
def test_overwrite(self):
|
||||
mem = WorkingMemory()
|
||||
mem.store("k", "v1")
|
||||
mem.store("k", "v2")
|
||||
assert mem.recall("k") == "v2"
|
||||
|
||||
def test_missing_key(self):
|
||||
mem = WorkingMemory()
|
||||
assert mem.recall("nonexistent") is None
|
||||
|
||||
def test_contains(self):
|
||||
mem = WorkingMemory()
|
||||
mem.store("present", "data")
|
||||
assert mem.contains("present") is True
|
||||
assert mem.contains("absent") is False
|
||||
|
||||
def test_clear(self):
|
||||
mem = WorkingMemory()
|
||||
mem.store("a", 1)
|
||||
mem.store("b", 2)
|
||||
mem.clear()
|
||||
assert mem.size() == 0
|
||||
|
||||
def test_capacity(self):
|
||||
mem = WorkingMemory(capacity=5)
|
||||
for i in range(10):
|
||||
mem.store(f"key{i}", i)
|
||||
assert mem.size() <= 5
|
||||
Reference in New Issue
Block a user