Files
sama/tests/test_memory/test_semantic.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

28 lines
774 B
Python

"""
Tests for SemanticMemory.
"""
import pytest
from dcos.memory.semantic import SemanticMemory
class TestSemanticMemory:
def test_add_and_get_fact(self):
mem = SemanticMemory()
mem.add_fact("dog", "species", "canine")
assert mem.get_fact("dog", "species") == "canine"
def test_add_relationship(self):
mem = SemanticMemory()
mem.add_relationship("dog", "wolf")
related = mem.get_related("dog")
assert "wolf" in related
assert "dog" in mem.get_related("wolf")
def test_query(self):
mem = SemanticMemory()
mem.add_fact("cat", "species", "feline")
mem.add_fact("lion", "species", "feline")
results = mem.query("species", "feline")
assert len(results) == 2