Files
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

36 lines
1.2 KiB
Python

"""
Tests for WorldModel.
"""
import pytest
from dcos.memory.world_model import WorldModel
class TestWorldModel:
def test_add_and_get_entity(self):
model = WorldModel()
model.add_entity("e1", {"type": "robot", "status": "active"})
entity = model.get_entity("e1")
assert entity is not None
assert entity["properties"]["type"] == "robot"
def test_update_entity(self):
model = WorldModel()
model.add_entity("e1", {"status": "inactive"})
model.update_entity("e1", {"status": "active"})
entity = model.get_entity("e1")
assert entity["properties"]["status"] == "active"
def test_set_and_get_state(self):
model = WorldModel()
model.set_state("phase", "exploration")
assert model.get_state("phase") == "exploration"
def test_query_entities(self):
model = WorldModel()
model.add_entity("drone1", {"type": "drone", "team": "alpha"})
model.add_entity("drone2", {"type": "drone", "team": "beta"})
model.add_entity("robot1", {"type": "robot", "team": "alpha"})
drones = model.query_entities("type", "drone")
assert len(drones) == 2