Files
sama/tests/test_memory/test_long_term.py
T
Celes Renata 57619860d5 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
2026-08-02 03:29:55 -07:00

31 lines
923 B
Python

"""
Tests for LongTermMemory.
"""
import pytest
from dcos.memory.long_term import LongTermMemory, Importance
class TestLongTermMemory:
def test_commit_and_recall(self):
mem = LongTermMemory()
mem.commit("important_fact", "AI is valuable", Importance.HIGH)
assert mem.recall("important_fact") == "AI is valuable"
def test_recall_missing(self):
mem = LongTermMemory()
assert mem.recall("nonexistent") is None
def test_consolidate(self):
mem = LongTermMemory()
count = mem.consolidate({"temp": "data"})
assert count == 1
assert mem.recall("temp") == "data"
def test_search(self):
mem = LongTermMemory()
mem.commit("python_info", "Python is a language", Importance.MEDIUM)
mem.commit("java_info", "Java is a language", Importance.MEDIUM)
results = mem.search("python")
assert len(results) > 0